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

NEW TO LISP - create a line with text offset

24 REPLIES 24
Reply
Message 1 of 25
Yunlena
2960 Views, 24 Replies

NEW TO LISP - create a line with text offset

Hey all,

 

I am a beginner at LISP and this is a bit out of my league... and I'm trying to create a lisp where I can draw a polyline between 2 points that also places text with the actual distance offset above the line.

 

I did find this post and thought it was helpful... but alas, I'm not quite catching on..

 

http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/need-labels-for-storm-pipe-lisp/td-p/...

 

Any help appreciated.

 

Thanks!

Christina

Best,
Christina
-------
Map 3D 2019 | Civil 3D 2019
Windows 10 | Lenovo P50S
24 REPLIES 24
Message 21 of 25
pbejse
in reply to: Yunlena


@ckako301 wrote:

That code works wonderfully also.

 

However, I am actually looking to override the distance with text that can be input by the user (not the distance from the line for the text itself). I hope that makes sense.

 

Everything else works great - I even didn't change it back to T 🙂

 

I really appreciate your help on this!!

 

Thanks!

Christina


So you want to be prompted for override [or accept the given distance] on every segment? 

 

Try the attached file Christina

Message 22 of 25
CodyJJackson
in reply to: pbejse

How can you make the text to show up as 1-0 instead of decimal?

 

Message 23 of 25
stevor
in reply to: CodyJJackson

One way for the string as an integer (rtos N 2 0) instead of (rtos N 2 2) Or in this case" (rtos (distance pt1 pt2) 2 0)
S
Message 24 of 25
Kent1Cooper
in reply to: CodyJJackson


@CodyJJackson wrote:

How can you make the text to show up as 1-0 instead of decimal?

 


[I think stevor may have misunderstood.]  If you want 1'-0", you can get that with a different mode number in the (rtos) function, in place of the 2 that makes it decimal [either 3 or 4 will do].  Or if your current Units are set to Engineering or Architectural, with an appropriate precision setting, you can just leave out the two numbers at the end of the (rtos) function that makes the text content -- (rtos (distance ... ...)).

 

But if by 1-0 you mean feet and inches without the foot mark or inch mark, or if by that you mean the equivalent of 1.0 but using a hyphen instead of a decimal point, that you will need to do with more code, because AutoCAD doesn't have a way to return text strings in that format directly.

 

In the former case, with the DIMZIN System Variable set to 3, and if the determining length is 12.0 drawing units, here's one way:

 

Command: (vl-string-subst "" "'" (vl-string-subst "" "\"" (rtos 12.0 4 0)))

 

returns


"1-0"

 

and likewise with a 3 instead of that 4.  [The 12.0 above is just to match your example -- keep the (distance) function in its place, in whatever version of a routine you're using.]

 

In the latter case:

 

Command: (vl-string-subst "-" "." (rtos 1.0 2 1))

 

returns


"1-0"

Kent Cooper, AIA
Message 25 of 25

I am soory It seems that i am too late .......

can you help me how to determine the text will be among the line & its scale and how to choose the distance between every word ......

 

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

Post to forums  

Autodesk Design & Make Report

”Boost