PDA

View Full Version : any suggestions on writing lisp..........


mom of 3
01-11-2004, 12:55 PM
morning.......
I'm not very good with lisp routines or anything dealing with the programming aspect, but I've got a HUGE project on which I think a lisp routine may come in very useful.....
I'm trying to find a way to make a label for my water main fixtures that I can label in my base drawing, & then will automatically scale to whatever scale I'm using on my sheets. for example, I'm drawing my base at 1:1, but my sheet will have a viewport at 1:100........I want to be able to label a water valve in my base drawing, then have the text show up the correct size without my messing with dim styles in my sheet.
I would appreciate any suggestions anyone would have.....thanks!
T

TCARPENTER
04-11-2004, 10:05 PM
T

Since no one has replied (thanks Rich for bringing this to my attention) I have a couple of questions for you.

1. Are you opposed to using VBA for this (it's been awhile since I've lisped)

2. Will you be adding labels through your a viewport from paper space or will you be doing this in modelspace? If the latter, how will you specify your text height/scale?

I can probably whip something up for you in VBA fairly quickly, if its lisp you're after, it may take a little while longer.

Let me know!

Todd

mom of 3
04-11-2004, 10:12 PM
I don't know exactly what a VBA is.......Rich tried to explain it to me & I still got lost.......

this is a project that I have taken over for someone who no longer works here. I believe it will be done in model space in the base drawing. as for the text stuff, that's SUPPOSEDLY already been done before I took over. as I mentioned, this is just a huge project & a lot of money for us, & Im' just trying to find the easiest & fastest way to label these hundreds of stupid valves. if you have an easier way, that's fine with me, as long as it can be explained to me so that I kind of understand it. if you haven't heard, I'm pretty technologically illiterate........ :oops:

thanks for responding!

Eddie
05-11-2004, 12:36 AM
8) OK so from what I understand....
you have drawing that already have the lables in MSPACE and want to have these autoscale to the viewport...
Also you want to have the same ability when adding new lables is this correct ?

And as asked by TCARPENTER
Will you be adding labels through your a viewport from paper space or will you be doing this in modelspace? If the latter, how will you specify your text height/scale?

regards,
Eddie

TCARPENTER
05-11-2004, 01:57 AM
Tami,

By any chance are all these valves blocks?

If so, what are the block names and do they have attributes associated with them? What version of AutoCAD are you using?

Thanks
Todd

mom of 3
05-11-2004, 02:54 PM
yes, all the valves & hydrants are blocks. I don't think they have any attributes, I'm in 2004, & they're just called "wv" & "e_hyd".....I don't think they're anything special, just something that someone here created at one time.

TCARPENTER
05-11-2004, 03:05 PM
Ok.

Probably the easiest ways to accomplish what you want, is to parse the drawing searching for each instance of the blocks named "wv" and "e-hyd". Then based on their insertion point, we can add the text you want to appear either next to them, on them whatever.

Now the big question is, what does the text need to say? If the each piece of text is drastically different for each block, then does it help to just add text the right scale so you can just edit it?

Let me know
Todd

mom of 3
05-11-2004, 03:13 PM
Todd -
you already lost me..........parse?

I have to number each valve & hydrant, as they're all numbered according to what the base has listed for them. oh yeah, I think I have some PIVs in there too......
anyway, I really don't know if I'm even asking what I want to ask. I need these labels (well, leaders, I guess) to show the number, but the text size has to match on all the sheets.......regardless of what my scale is. I believe for the most part, they'll all be at 100 scale, but I don't want to have to redo the text per each sheet. if I have to do that, I will.......I was just hoping to find a quicker way so that I didn't have to label each sheet separately.........as I've got 26 sheets that these fixtures are on, with who knows how many fixtures per sheet.......?

Tami

TCARPENTER
05-11-2004, 08:24 PM
Sorry to get back to you so late, got tied up working. The attached bitmap is the beginnings of what I had in mind, take a look and let me know what you think.

I'm on my way out out here so I'll check in later tonight.

Todd

hyposmurf
05-11-2004, 11:07 PM
Attached where?

TCARPENTER
05-11-2004, 11:57 PM
Oops... Guess it had to be a JPG image too...

Try this...

mom of 3
08-11-2004, 10:13 PM
ok, so what command would that be if I wanted to try that? would that change my block each time I add a new one.........say similar to title block attributes?

TCARPENTER
09-11-2004, 07:34 PM
Tami,

Your request turned into what I think would be a fairly handy tool for some of the things I do as well. Attached is the first pass of this thing - it's probably not an ideal programming example and by no means is it foolproof. The error checking is minimal, but there is not a lot to go wrong (in terms of things that will mess up your drawing) - that doesn't mean the routine won't bomb though. So give this thing a try and see if meets your needs or not. Make a copy of one of the drawings where you need to label all the valves, and try it out.

For your first run at this, make sure the form is filled out just like the screen shot I've attached, and press the button marked "Label All", then press the button marked "Done". Zoom in to see if the routine performed how you wanted it to.

This thing by the way in not AutoLISP its VBA. I know you're not terribly familiar with VBA so in case you don't how to load and run a VBA project here's how:

At the command line type: "VBAMAN" (no quotes) and press enter.
In the dialog box that appears, press the button on the right hand side labeled "Load..."
Then, in the file dialog box, navigate to where you copied the dvb file, select the file, and then press the button labeled "Open".
Back at the VBA Manager dialog box, you should now have a button labeled "Macros..." press it.
You will probably have only one VBA routine in your list, but in case you don't, you're looking for the the routine looking something like "... \BlockLabeler.dvb!mdlBlockLabeler.LabelBlocks" when you find this, highlight it and press the button labeled "Run". You should next see the attached dialog box.

Some notes:

The combo box labeled: "Block Name to Label:" must have a block name selected when using the "Label All" button, but not when using the "Select Blocks" button.
The combo box labeled: "Dimension Style:" - if you select a dimension style with no leader information in it, - you'll get an error.

Let me know how it works (or doesn't :oops: as is sometimes prone to happen!)

Todd