Subidoooo Posted June 8, 2023 Posted June 8, 2023 Hi Guys I am looking for a lisp that will place a certain block on every vertices of a 3D polyline. ive found some on different forums but looking for one that works with a 3D poyline Quote
Steven P Posted June 8, 2023 Posted June 8, 2023 Should be easy to work out, this will give you the vertices of a 3d polyline (google search "3d polyline vertices"): https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polyline-vertices/td-p/1927067#:~:text=Here're two ways. Using DXF codes vertices are,(cdr (assoc 10 elst)) lst) vtx (entnext vtx) From the list of points do a 'foreach' loop and (command "-insert"..... ) to insert a block - a search will show the syntax for theese Put together to give something like: (defun c:InsBlk ( / poly lst blkname) ;;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polyline-vertices/td-p/1927067#:~:text=Here%27re%20two%20ways.%20Using%20DXF%20codes%20vertices%20are,%28cdr%20%28assoc%2010%20elst%29%29%20lst%29%20vtx%20%28entnext%20vtx%29 (defun 3d-coord->pt-lst (lst) (if lst (cons (list (car lst) (cadr lst) (caddr lst)) (3d-coord->pt-lst (cdddr lst)) ) ; end cons ) ; end if ) ; end defun (setq blkname "YourBlockName") ;; define your block name to insert. Could also 'entsel' to pick a block to insert (setq poly (car (entsel))) ;; Select the polyline (setq lst (3d-coord->pt-lst (vlax-get (vlax-ename->vla-object poly) 'Coordinates))) ;; Get the points list from subfunction, above (foreach pt lst ;; for each loop start (command "-insert" blkName pt 1 1 0) ;; insert 'blkname' block (YourBlockName block) ) ; end for each loop ) ; end function You could also look at chainage LISPs some do similar things but just ignore the text creation most have to put in the distances 1 Quote
Recommended Posts
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.