measure length distance of arc

measure length distance of arc

dize906
Community Visitor Community Visitor
301 Views
1 Reply
Message 1 of 2

measure length distance of arc

dize906
Community Visitor
Community Visitor

Good morning

I should make, with autocad/c3D/Dynamo, a file that exports distances automatically.


In image 1, there are two alligments (the green ones).
the white lines are offsets (by 5cm) of that horizontal path

i need to create a lisp file that will measure the distance (the one of 9.8554 i said that one only as an example) automatically.

this distance is the one that is generated every 5cm offset between the two paths. and that then be exported these distances automatically; of course the distance will be different when the paths are curved.

 

immagine2.PNG

  

or in image2 (maybe you can see better) there are the two paths (in green) and I need a lisp file, which measures the distance (99,21) that is generated every 5cm (these 5cm will be fixed).
obviously if there are curves the distance 99.21 will be different.immagine1.PNG

 

 

Also in the file "measure lisp.dwg" you can find a better explanation.

 

Thanks in advance

0 Likes
302 Views
1 Reply
  • Lips
Reply (1)
Message 2 of 2

ronjonp
Mentor
Mentor

@dize906 Give this a try:

 

 

(defun c:foo (/ bas h i int ll mp off p1 p2 r ur)
  ;; RJP » 2024-07-18
  (defun _int (o1 o2) (mapcar '+ '(0 0 0) (vlax-invoke o1 'intersectwith o2 0)))
  (cond
    ((and (or (setq off (getdist "\nEnter offset:<50>")) (setq off 50))
	  (setq bas (car (entsel "\nPick baseline: ")))
	  (setq int (car (entsel "\nPick intersect line: ")))
     )
     (vla-getboundingbox (vlax-ename->vla-object int) 'll 'ur)
     (mapcar 'set '(ll ur) (mapcar 'vlax-safearray->list (list ll ur)))
     (setq h (abs (cadr (mapcar '- ll ur))))
     (setq ur (list (car ur) (cadr ll) (caddr ur)))
     (setq i 0)
     (while (< i h)
       (setq r (cons (vlax-ename->vla-object
		       (entmakex (list '(0 . "LINE")
				       '(8 . "LINE")
				       (cons 10 (mapcar '+ (list 0 i 0) ll))
				       (cons 11 (mapcar '+ (list 0 i 0) ur))
				 )
		       )
		     )
		     r
	       )
       )
       (setq i (+ i off))
     )
     (setq r (reverse r))
     (setq int (vlax-ename->vla-object int))
     (while (cadr r)
       (cond
	 ((and (setq p1 (_int int (car r))) (setq p2 (_int int (cadr r))))
	  (print (setq d (- (vlax-curve-getdistatpoint int p1) (vlax-curve-getdistatpoint int p2))))
	  (setq mp (mapcar '/ (mapcar '+ p1 p2) '(2 2 2)))
	  (setq r (cdr r))
	  (entmake (list '(0 . "TEXT")
			 '(100 . "AcDbEntity")
			 '(67 . 0)
			 '(100 . "AcDbText")
			 '(8 . "TEXT")
			 (cons 10 mp)
			 (cons 40 (/ off 2))
			 (cons 1 (rtos d 2 2))
			 '(50 . 0.0)
			 '(41 . 1.0)
			 '(51 . 0.0)
			 '(71 . 0)
			 '(72 . 1)
			 (cons 11 mp)
			 '(210 0.0 0.0 1.0)
			 '(100 . "AcDbText")
			 '(73 . 2)
		   )
	  )
	 )
       )
     )
    )
  )
  (princ)
)

 

2024-07-18_16-45-00.gif