Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Need Lisp routine to label splined pline contour lines

12 REPLIES 12
SOLVED
Reply
Message 1 of 13
zootango
5024 Views, 12 Replies

Need Lisp routine to label splined pline contour lines

Does anyone have a lisp routine that will label splined polyline contour lines w/ z values?

 

Would be nice if the routine applied a background mask to an mtext label if possible.

 

Have tried searching the net for routines but most of them do not work or do not have a background mask or wipeout.

 

Thanks so much

12 REPLIES 12
Message 2 of 13
3wood
in reply to: zootango

Message 3 of 13
Kent1Cooper
in reply to: zootango


@zootango wrote:

Does anyone have a lisp routine that will label splined polyline contour lines w/ z values?

 

Would be nice if the routine applied a background mask to an mtext label if possible.

....


I had something that did most of that, which I have modified.  It uses Text rather than Mtext, partly because that's what was in the other routine, and partly because there's nothing Multi-line about the Z value of an object.  It works on any kind of object with linearity [Line, Arc, Circle, Ellipse, Spline, Polyline of any kind, Xline, Ray].  If it's not of constant elevation, it labels it with the elevation at the point of selection.  It has some additional options you might not need [e.g. width factor for the Text], which were part of the other routine, so I left them in.

 

You have some choices you can make about preferred defaults; see the comments that say ;; <-- EDIT ....

 

Message EDIT:  I realized I hadn't adjusted everything that I should have -- the source routine Trimmed, and some prompts and comments still talked about that, and because this one doesn't, it's not necessary to forbid selection of things on locked Layers.  New file now attached.

Kent Cooper, AIA
Message 4 of 13
zootango
in reply to: Kent1Cooper

When I load labelelevmask.lsp and type LEM to run it, I just get a Bad Argument error?
Message 5 of 13
Kent1Cooper
in reply to: zootango


@zootango wrote:
When I load labelelevmask.lsp and type LEM to run it, I just get a Bad Argument error?

I just tried it out again, and it works for me.  Does it say any more than that, e.g. what kind of Bad the Argument is?  Did you go through and set default values appropriate to your circumstances for all the choices?  It's set up for the way I would use it, but [for example] if you didn't substitute a text Style name that you use, and you don't have a text Style in your drawing of the name I use, it will complain.

Kent Cooper, AIA
Message 6 of 13
braudpat
in reply to: Kent1Cooper

 

Hello Kent

 

1) Thks for your routine !

 

2) May I ask for a few improvments !?

- Why you don't let the option to use the current style ?

Why I always get a ROMANS style that I don't like at all !

-  Then I would like a standard Metric dimension (Units = Meters, Defaut height = 1.00) 

and unfortunateley I don't see very well where I have to patch your code ...

So please could you help me and other "Metric" people !?

 

3) Wipeout behind the text is OK for a standard Dwg and a standard Print/Plot

But with PDF we can "aleatory" get big problem with Wipeouts !

So please could you implement an other way to "protect" the text

- Draw a 4 points rectangle SOLID with the true Color 255,255,255

- and then the Text above ...

So no problem when plotting/printing and IDEM on PDF ...

 

Thks in advance

 

 

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 7 of 13
Kent1Cooper
in reply to: braudpat


@braudpat wrote:

....

- Why you don't let the option to use the current style ?

Why I always get a ROMANS style that I don't like at all !

-  Then I would like a standard Metric dimension (Units = Meters, Defaut height = 1.00) 

and unfortunateley I don't see very well where I have to patch your code ...

So please could you help me and other "Metric" people !?

 

3) Wipeout behind the text is OK for a standard Dwg and a standard Print/Plot

But with PDF we can "aleatory" get big problem with Wipeouts !

So please could you implement an other way to "protect" the text

- Draw a 4 points rectangle SOLID with the true Color 255,255,255

- and then the Text above ...

.... 


As I said in both of my replies, it's set up the way I would use it but it allows you to set it up for whatever your preferences are -- you need to follow the instructions where it says "Edit the following as desired..." [which applies to several (if) functions that follow it] and a couple of other individual spots where the word EDIT appears.

 

The Textmask approach is quite a bit simpler than putting a Solid behind the Text, since it figures out the size, shape and rotation for you, in addition to inherently putting the mask behind the Text and in front of everything else.  I just tried plotting something to .PDF and it came out looking normal, so I'm not inclined to "fix" that part myself, unless and until I find it causes whatever problems you mention.  There are routines on this Forum that use a Solid or 3Dface for this kind of thing,, but I'll let someone else find them and incorporate that part.

Kent Cooper, AIA
Message 8 of 13
Kent1Cooper
in reply to: Kent1Cooper


@Kent1Cooper wrote:

....

So please could you implement an other way to "protect" the text

- Draw a 4 points rectangle SOLID with the true Color 255,255,255

....


....

 

The Textmask approach is quite a bit simpler than putting a Solid behind the Text....  .... I'm not inclined to "fix" that part myself....


But I figured it out anyway.  I had found that (acet-...) command somewhere in looking for a way to make text masks in Lisp, and since it has "wipeout" in it, I figured there ought to be an equivalent with "solid" since the manual Textmask Express Tool has an option make Solids.  Look through the attached LabelTextMaskS.lsp [the S is for Solid] for "solid" and "wipeout" to see the changes.  I left the command name the same LTM, figuring most people would use one or the other of them, but probably not both.  The iffy part was setting the color, and I don't know what the 3 is for in that function.  Limited testing.

Kent Cooper, AIA
Message 9 of 13
braudpat
in reply to: Kent1Cooper

Hello Kent

 

1) Thks for your effort

 

2) This WE, I have done some limited tests on a PC with Win XP Pro and ACAD/MAP 201X 32 bits French

and the routine was running fine !

 

3) I changed only ONE thing in your original routine at about line 195 :  (command "Text"  ---> (command "_Text"

 

4) Today I am on my favorite PC (Win 7 Pro x64 and ACAD/MAP 201X 64 bits) and I always get the error :

with both routines ...

 

Commande: LEM
Error: type d'argument incorrect: numberp: nil

 

Commande: LTM
Text content:
Error: type d'argument incorrect: numberp: nil

 

So I don't understand ! Maybe there is something linked to the 64 bits version of ACAD/MAP 201X !?

Both routines have been tested on ACAD and on ACAD MAP ... 2014 and 2013 ...

 

Thks in advance for your help ...

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 10 of 13
Kent1Cooper
in reply to: braudpat


@braudpat wrote:

.... 

3) I changed only ONE thing in your original routine at about line 195 :  (command "Text"  ---> (command "_Text"

 

4) Today I am on my favorite PC (Win 7 Pro x64 and ACAD/MAP 201X 64 bits) and I always get the error :

with both routines ...

 

Commande: LEM
Error: type d'argument incorrect: numberp: nil

 

Commande: LTM
Text content:
Error: type d'argument incorrect: numberp: nil

 

So I don't understand ! Maybe there is something linked to the 64 bits version of ACAD/MAP 201X !?

.... 


On number 3), that was a holdover from an older routine I was modifying -- I don't normally do that, and I've "fixed" that in the attached.  I also found that (acet-textmask-... functions are subject to Object snap, so I included controlling for that, and some other little refinements.  And I realized that I had posted the Text version that asks the User for text content, rather than the Elevation version that gets it from the selected object(s) and is appropriate to this thread.  Attached are both Elevation routines [LabelElevMask.lsp uses Wipeouts, LabelElevMaskS uses Solids].

 

I don't know about the numberp error.  They work for me, but here I'm back on AutoCAD 2004.  Elsewhere I can use 2015 now, and that's where I worked up the version of LabelTextMaskS.lsp I posted most recently, but I'll test the rest when I get there again.

Kent Cooper, AIA
Message 11 of 13
braudpat
in reply to: Kent1Cooper

Hello Kent

 

1) Thks for your effort

 

2) I am on a ACAD MAP 2011 x64 French and with both routines, I get :

Error: type d'argument incorrect: numberp: nil

idem on my ACAD 2013 x64 French ...

 

So I will change to my good old Win XP Pro 32 bits PC ...

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 12 of 13
braudpat
in reply to: braudpat

 

Hello Kent

 

Sorry for the delay I just come back ...

I confirm that the problem is linked to the 64 bits version of ACAD 201X or MAP 201X !

 

Because on my old Win XP Pro 32 bits PC with ACAD MAP 2012 French and with ACAD 2014 French,

BOTH LATEST routines are OK !!

 

Thks again ...

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 13 of 13
braudpat
in reply to: braudpat

 

Hello Kent

 

Sorry for the delay, I have retested the 3 routines (LEMx2 , LTM)

and of course they are OK on my ACAD / MAP French 201X 32 and 64 bits !

 

---> You were right and I am a "stupid boy" !

Because when testing, I used sometimes a DWG with a ROMANS text style and sometimes a DWG without any ROMANS text style !!

 

Thks a lot for these 3 routines which are nice, I appreciate ...

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost