Message 1 of 13
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
(defun c:divline ( / pt1 pt2 div ang maths ent)
(setq pt1 (getpoint "Select first point: "))
(setq pt2 (getpoint "Select end point: "))
(setq div (getint "Enter number of segments to divide line: "))
(setq ang (angle pt1 pt2))
(entmake (list
'(0 . "LINE")
'(8 . "0")
(cons 10 (polar pt1 (angle pt1 pt2) 0))
(cons 11 (polar pt2 (angle pt1 pt2) 0))
)
)
(setq maths (/ (distance pt1 pt2) div))
(entmake (list
'(0 . "LINE")
'(8 . "CX-TEXT")
(cons 10 (polar pt1 (+ ang (/ pi 2)) 0.25))
(cons 11 (polar pt1 (- ang (/ pi 2)) 0.25))
)
)
(repeat div
(setq ent (entlast))
(command "._offset" maths ent pt2 "")
)
(princ)
)
Hello all!
I'm still learning LISP and I'm looking to try and take more advance approaches on my writing. The attached code works fine, but I'm curious to see if there is a more logical approach that I may not be thinking of. Any advice on how I can write more logically or any outside of the box approaches using different functions would be great! Looking forward to continuously improving!
Thanks in advance! 😁
Solved! Go to Solution.