Is there a lisp that will align Blocks to the end of a PLine perpindicular in bulk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
so as I asked in the title is there a possibility of a lisp that can do this? image added for clarification. they always need to be straight as shown in the picture. the orange thing is a (block reference) we use here in the company. we have a lisp that sometimes does work and alot of times puts it wrong like in the picture.
here is that lisp, if someone could help me that would be greatly appreciated! the lisp may be changed or if you have a all new lisp that already does this, feel fre e to share it with me! cheers! it is always for 2D drawings
(defun C:ABP (/ picksize bss n pss ins bdata box pl); = Align Blocks to Polylines
(setq picksize (* (getvar 'viewsize) (/ (getvar 'pickbox) (car (getvar 'screensize)))))
(if (setq bss (ssget "_:L" '((0 . "INSERT"))))
(repeat (setq n (sslength bss))
(if
(setq pss ; is insertion point on a Polyline?
(ssget "_C"
(mapcar '-
(setq ins (cdr (assoc 10
(setq bdata (entget (ssname bss (setq n (1- n))))))))
(setq box (list picksize picksize))
); mapcar
(mapcar '+ ins box)
'((0 . "*POLYLINE"))
); ssget
); setq
(entmod ; then
(subst
(cons 50
(angle
'(0 0 0)
(vlax-curve-getFirstDeriv (setq pl (ssname pss 0))
(vlax-curve-getParamAtPoint pl (vlax-curve-getClosestPointTo pl ins))
); ...FirstDeriv
); angle
); cons
(assoc 50 bdata)
bdata
); subst
); entmod
); if [Polyline there or not]
); repeat
); if [selected Block(s) or not]
(princ)
); defun
(vl-load-com)