Hi all,
Is there a way or a lisp to scale multiple 3d polylines, at same time, and the base point is the start point of each one?
thanks.
@komis wrote:....
Is there a way or a lisp to scale multiple 3d polylines, at same time, and the base point is the start point of each one?
....
This seems to do that, in limited testing:
(defun C:Scale3DPs (/ sc 3DPss 3DP)
(vl-load-com)
(setq sc (getreal "\nScale factor to apply to 3DPolylines: "))
(if (setq 3DPss (ssget '((0 . "POLYLINE")))); User selection contains some
(repeat (sslength 3DPss)
(setq 3DP (ssname 3DPss 0)); first [remaining] one
(if (= (cdr (assoc 100 (reverse (entget 3DP)))) "AcDb3dPolyline"); [not "heavy" 2D]
(command "_.scale" 3DP "" (vlax-curve-getStartPoint 3DP) sc)
); if
(ssdel 3DP 3DPss); remove that one
); repeat
); if
); defun
That asks the User to select things, out of which it only scales the 3DPolylines. If you want it to do it to all 3DPolylines, without User selection, change the fourth line to:
....
(if (setq 3DPss (ssget "_X" '((0 . "POLYLINE"))))
....
You can get more sophisticated, such as with error handling, Osnap control, saving the scale factor and offering it as a default on subsequent use, perhaps building in a fixed scale factor instead, ignoring any not in the current space, etc., but see what you think.
(defun c:3PLS (/ _only3dPline lst sf) (defun _only3dPline (ss / i e lst) (if (eq (type ss) 'PICKSET) (progn (repeat (setq i (sslength ss)) (if (eq (cdr (assoc 100 (reverse (entget (setq e (ssname ss (setq i (1- i)))))))) "AcDb3dPolyline" ) (setq lst (cons (list (vlax-ename->vla-object e) (vlax-curve-getStartPoint e)) lst)) ) ) lst ) ) ) (if (and (setq lst (_only3dPline (ssget "_:L" (list '(0 . "POLYLINE") (if (eq (getvar 'CVPORT) 1) (cons 410 (getvar 'CTAB)) '(410 . "Model") ) ) ) ) ) (progn (initget 6) (setq sf (getreal "\nSpecify scale factor: "))) ) (foreach x lst (vlax-invoke (car x) 'ScaleEntity (cadr x) sf)) ) (princ) ) (vl-load-com) (princ)