Originally Posted by
radosak368138
...The task should be similar to the _measure command but, I would like to divide the spline into lengths that I give in input. (Decided by user)
...
Place a block at length:...and so on..
Code:
(defun c:demo ( / doc spc obj dst d distancevalue)
(setq doc (vla-get-activedocument (vlax-get-acad-object))
spc (vlax-get-property
doc
(if (= 1 (getvar 'CVPORT))
'Paperspace
'Modelspace
)
)
)
(if (and (setq distancevalue nil
obj (car (entsel)))
(wcmatch (cdr (assoc 0 (entget obj))) "*LINE")
(setq dst
(vlax-curve-getdistatparam obj (vlax-curve-getendparam obj))
)
)
(while
(progn
(setq d (getdist "\nEnter distance: "))
(cond
((null d) nil )
((> d dst) d (princ "\nExceeds Entity Length"))
(T
(Vlax-invoke spc
'InsertBlock (vlax-curve-getpointatdist obj d)
"BlockName" 1 1 1 0
)
(setq distancevalue (cons d distancevalue))
(princ (strcat "\nBlock inserted at distance " (rtos d 2 2))
)
)
)
)
)
(princ "\nInvalid Object")
)
(foreach p (reverse distancevalue)
(print p))
(princ)
)
(vl-load-com)
EDIT: Oops, There's another thread just like this. my bad