- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have this lisp written kindly by @marko_ribar.
It aligns attribute to 3Dpolyline.
It is grate. But in the DWG file attached the 3D polyline and the blocks where inserted separately so I think there is a small gap of 0.000... between the insertion point of the block and the vertex of the 3D polyline so for some reason the lisp does not work.
If someone could help me modify it I will really appreciate the help.
This is the lisp:
(defun c:aliblopols ( / LM:MakeReadable s i pol ss loop n lstpar blo p dir lstpar )
(defun LM:MakeReadable ( a )
;; © Lee Mac 2010
(
(lambda ( a )
(cond
( (and (> a (/ pi 2)) (<= a pi))
(- a pi)
)
( (and (> a pi) (<= a (/ (* 3 pi) 2)))
(+ a pi)
)
( t a )
)
)
(rem a (* 2 pi))
)
)
(prompt "\nSelect polyline entities on which you want to make block alignments readable...")
(setq s (ssget (list (cons 0 "*POLYLINE"))))
(repeat (setq i (sslength s))
(setq pol (ssname s (setq i (1- i))))
(setq ss (ssget "_X" (list (cons 0 "INSERT") (cons 2 "M1502_P"))))
(if (= (logand 1 (cdr (assoc 70 (entget pol)))) 1)
(setq loop (fix (vlax-curve-getEndParam pol)))
(setq loop (1+ (fix (vlax-curve-getEndParam pol))))
)
(setq n -1)
(repeat loop
(setq lstpar (cons (vlax-curve-getpointatparam pol (setq n (1+ n))) lstpar))
)
(setq n -1)
(repeat (sslength ss)
(setq blo (ssname ss (setq n (1+ n))))
(setq p (cdr (assoc 10 (entget blo))))
(if (member p lstpar)
(progn
(setq dir (LM:MakeReadable (angle (list 0.0 0.0) (vlax-curve-getFirstDeriv pol (vlax-curve-getparamatpoint pol p)))))
(vlax-put (vlax-ename->vla-object blo) (quote rotation) dir)
)
)
)
(setq lstpar nil)
)
(princ)
)
(prompt "\nType ALIBLOPOLS to run the topo point alignment command on a polyline(s)\n")
(princ)
Solved! Go to Solution.