(vl-load-com)
;;; to make a 3d polyline*******************************************
(defun c:pol (/ adoc spc ss cnt plst 3dline)
(setq adoc(vla-get-activedocument(vlax-get-acad-object)))
(setq spc(vlax-get adoc
(if (equal (getvar "cvport") 1)
'PaperSpace
'ModelSpace
);_if
)
);_setq
(setq ss (ssget '((0 . "POINT"))));_select only point objects
(if ss
(progn
(setq cnt 0);_loop counter
(setq plst '());_empty list
(while (< cnt (sslength ss))
(setq plst (cons(cdr(assoc 10(entget (ssname ss cnt))))plst));_make point list
(setq cnt (1+ cnt));_incerase counter
);_while
(setq 3dline (vla-add3dpoly ;_make 3d polyline
spc
(vlax-safearray-fill
(vlax-make-safearray vlax-vbDouble
(cons 0 (1- (length (apply 'append plst)))))
(apply 'append plst)))
);_setq add 3dpoly
);_progn
);_if
(princ)
);_defun
;;; to make a 3d spline******************************************
(defun c:spl (/ adoc spc ss cnt plst 3dline stpt ept)
(setq adoc(vla-get-activedocument(vlax-get-acad-object)))
(setq spc(vlax-get adoc
(if (equal (getvar "cvport") 1)
'PaperSpace
'ModelSpace
);_if
)
);_setq
(setq ss (ssget '((0 . "POINT"))))
(if ss
(progn
(setq cnt 0);_loop counter
(setq plst '());_empty list
(while (< cnt (sslength ss))
(setq plst (cons(cdr(assoc 10(entget (ssname ss cnt))))plst))
(setq cnt (1+ cnt));_incerase counter
);_while
(setq stpt (vlax-3d-point '(0.0 0.0 0.0)));_start pt for spline
(setq ept (vlax-3d-point '(0.0 0.0 0.0)));_end pt for spline
(setq cline (vla-addspline
spc
(vlax-safearray-fill
(vlax-make-safearray vlax-vbDouble
(cons 0 (1- (length (apply 'append plst)))))
(apply 'append plst))
stpt
ept
)
);_setq add 3d spline
);_progn
);_if
(princ)
);_defun
No comments:
Post a Comment