Jump to content
lucky9

Distance between lines

Recommended Posts

lucky9

Need a lisp that would calculate distance between lines in a map and place it at the center of each lines.

 

I need to select all the lines at once instead of selecting each line one by one.

 

Regards,

lucky9

Share this post


Link to post
Share on other sites
BIGAL

Now where is the crystal ball so I can see what you want.

 

 

Please post a dwg or image.

Share this post


Link to post
Share on other sites
lucky9

Sample Drawing is attached for your reference..

it would be nice if the lengths are placed similar as it is shown in the drawing.

 

 

thanks :)

05 Key Map_Drawing_SAMPLE.dwg

Share this post


Link to post
Share on other sites
hanhphuc
Posted (edited)

hi you should ask lisp question in

AutoLISP forum

 

(defun c:test (/ en d p p2 tx1 tx2)
 (setvar 'dimasz 15)
 (while (setq en (car (entsel "\nPick polyline.. ")))
   (and (wcmatch (cdr(assoc 0 (entget en))) "*LINE")
 (setq d   (vlax-curve-getdistatpoint en (vlax-curve-getendpoint en))
       p   (vlax-curve-getpointatdist en (* d 0.5))
       tx1[color="purple"] "100MM %%C"[/color] 
       tx2 (strcat "L=" (rtos d 2 0) "M")
       p2  (if (and pointer:marker msg:pointer) ([color="blue"]msg:pointer[/color] (list[color="red"] (trans p 0 1)[/color]) 1 (strcat tx1 "\\P" tx2))
	     (getpoint p "\nSpecific next point.. "))
       )
 
 (vl-cmdf "_leader" "_non" [color="red"](trans p 0 1)[/color] "_non" p2 "" tx1 tx2 "")
)
   )
 (princ)
 )

 

visual utility

msg:pointer

 

p/s: @BIGAL i noticed you were offline while the OP was online my quick reply didn't mean to hijack. :)

Edited by hanhphuc
(trans p 0 1)

Share this post


Link to post
Share on other sites
lucky9

Hi there , I tried your solution when selecting the polyline it does nothing.

 

here is a screen capture.

 

f3adacfcc413994e0234832aca2ffa33.gif

 

 

Btw, I post the question in wrong section by mistake if any mod would move this post to the right section would be appreciated.

 

Thanks :)

Share this post


Link to post
Share on other sites
hanhphuc
Hi there , I tried your solution when selecting the polyline it does nothing.

 

here is a screen capture.

 

Btw, I post the question in wrong section by mistake if any mod would move this post to the right section would be appreciated.

 

Thanks :)

 

did you download the visual utility link provided ?

missing routine?

pointer:marker

msg:pointer

 

i edited previous post, try it still can run without these visual utilities.

please retry :)

 

 

g3gl3md.gif

Share this post


Link to post
Share on other sites
lucky9
did you download the visual utility link provided ?

missing routine?

pointer:marker

msg:pointer

 

i edited previous post, try it still can run without these visual utilities.

please retry :)

 

 

g3gl3md.gif

 

I didn't download it ,

 

are you referring to msg:pointer code?

 

Awesome !

Thanks :)

Share this post


Link to post
Share on other sites
BIGAL

Hanhphuc I would use the simple check for a library routine. I like the look of the pointer code will have a closer look.8)

 

(if (not msg:pointer)(Load "msg-pointer")) ; save lisp as say msg-pointer

Share this post


Link to post
Share on other sites
hanhphuc
Hanhphuc I would use the simple check for a library routine. I like the look of the pointer code will have a closer look.8)

 

(if (not msg:pointer)(Load "msg-pointer")) ; save lisp as say msg-pointer

 

Thanks BIGAL it makes sense, if OP keeps this sub different file :)

Share this post


Link to post
Share on other sites
lucky9
Thanks BIGAL it makes sense, if OP keeps this sub different file :)

 

Guys could you please elaborate more... I'm pretty basic in lisp. :D

 

What is visual utility and how to install it or make it to work?

 

Thank you ! :)

Share this post


Link to post
Share on other sites
lucky9

Although, your solution worked pretty awesome! but what is this visual utility thingy?

Share this post


Link to post
Share on other sites
hanhphuc
Although, your solution worked pretty awesome! but what is this visual utility thingy?

 

it was just my naming for those transient routines.

ACAD also has osmode, gridmode , 3dorbit & vslide etc..

 

example getpoint 'rubber band'

(setq [color="red"]p[/color] (getpoint ))
(setq p2 (getpoint [color="red"]p[/color]))[color="green"] ; <-- with rubberband [/color]

 

 

(setq [color="red"]p[/color] (getpoint ))
(setq p2 (getpoint ))[color="green"] ; <-- without rubberband you can't see startpoint [/color]

 

you can call any naming as you like.

Share this post


Link to post
Share on other sites
lucky9

Thank you! hanhphuc :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×