- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Everyone,
I am Pankaj. I am Civil Engineer not from Programming background with lot of exploring mindset the below LISP code was drafted by me with the help of few open source knowledge and few debugging and correction process with the help of ChatGPT for drawing perpendicular lines to the selected polyline from the selected points.
(defun c:DLPP ()
;DLPP-Draw perpendicular lines for the selected polyline from the selected points
(setq poly (car (nentsel "\nSelect polyline: ")))
(setq poly-obj (vlax-ename->vla-object poly))
(setq ss (ssget "_:L" '((0 . "POINT"))))
(setq points (list))
(if ss
(progn
(setq numPoints (sslength ss))
(setq i 0)
(while (< i numPoints)
(setq pt (cdr (assoc 10 (entget (ssname ss i)))))
(setq points (cons pt points))
(setq i (1+ i))
)
)
)
(foreach pt points
(setq perp-point (vlax-curve-getClosestPointTo poly-obj pt))
(command "line" pt perp-point "")
)
(princ)
)
I am not sure what is the problem with this code i have tried all the possible debugging process but the perpendicular lines drawing process works only in few versions of the Autocad.
I am Using AUTOCAD 2024 in which it works as per my requirement.
But in another PC AUTOCAD 2023 in which certain start points are not taken correctly and it takes vertexes and mid between two vertexes as the start point which is resulting in not meeting the requirement.
Please help me out with my code debugging process.
If needed please suggest me with the new approach of this LISP code for my idea of DLPP-Drawing Perpendicular lines for the selected polyline from the selected points.
Thanks in Advance,
regards,
Pankaj
Solved! Go to Solution.