Jump to content

Distance between lines


lucky9

Recommended Posts

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

Link to comment
Share on other sites

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)
Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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 ! :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...