• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

measure polyline length between two lines

  • Thread starter Thread starter Dr.Lube
  • Start date Start date

Dr.Lube

Guest
hello to all, I renew a request made a little time ago (updated to the current situation).

I would have to measure the length of a polyline between two lines that I insert.

polylinea to measure comes from a block (you could explode and make a undo? )
2014-12-17 17_13_33-Autodesk AutoCAD 2015 - [Finestra verifica blocco - PilastroRETT].webpHow can you do not by hand?
by hand I would explode the block and make a size so that I only remain the part between the two lines. .

Thank you so much!

dennis
 
test in this way, for lines and polyline (no block):
Code:
(defun c:test ( / l1 l2 poly ps i1 i2 p1 p2 d1 d2 psel par1 par2 lp)

(setq l1 (vlax-ename->vla-object (car "\nselezionare la prima linea"))))
(setq l2 (vlax-ename->vla-object (car (entsel "\nselezionare la seconda linea"))))
(setq poly (vlax-ename->vla-object (car (setq ps (entsel "\nselezionare il tratto di polilinea da misurare")))))

(if (and
(setq i1 (vlax-invoke l1 'intersectwith poly acextendnone))
(setq i2 (vlax-invoke l2 'intersectwith poly acextendnone))
)
(progn)
(setq p1 (list (car i1)(cadr i1)(caddr i1)))
(setq p2 (list (car i2)(cadr i2)(caddr i2)))

(setq d1 (vlax-curve-getdistatpoint poly p1))
(setq d2 (vlax-curve-getdistatpoint poly p2))

(setq psel (vlax-curve-getclosestpointto poly (cadr ps)))

(setq par1 (vlax-curve-getparamatpoint poly p1))
(setq par2 (vlax-curve-getparamatpoint poly p2))

(if
(<=
(min par1 par2)
(vlax-curve-getparamatpoint poly psel)
(max par1 par2)
)
(setq lp (abs (-d1 d2))
(setq lp (- (vla-get-length poly)
)
)
)
(if lp (princ (strcated "\nlunghezza of the tratto: " (rtos lp))))))
(princ)
)
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top