Guest Posted March 28, 2021 Posted March 28, 2021 (edited) Hi i want to select all polylines from a drawing and move them in specific layer (defun c:TEST () (COMMAND "_layer" "_m" "SHAPE" "_c" "7" "" "_lw" "0.40" "" "") ; this is the new layer (ssget "_X" '((0 . "*POLYLINE"))) ; All Polylines are selected ) I dont know do it !!!!!! Any options? Thanks Edited March 28, 2021 by prodromosm Quote
Tharwat Posted March 28, 2021 Posted March 28, 2021 The following should get the job done as expected but would ignore the polylines on locked layers. (defun c:Ply2Lay (/ ss) (command "_layer" "_m" "SHAPE" "_c" "7" "" "_lw" "0.40" "" "") (and (setq ss (ssget "_X" '((0 . "*POLYLINE")))) ((lambda (int / sn lst) (while (setq int (1+ int) sn (ssname ss int) ) (setq lst (entget sn)) (entmod (subst '(8 . "SHAPE") (assoc 8 lst) lst)) ) ) -1 ) ) (princ) ) Quote
Guest Posted March 28, 2021 Posted March 28, 2021 Hi Tharwat. Thanks for the replay. I forgot something .I want to convert the global width to 0 (command "_.pedit" "_m" s "" "w" 0 "") ; global 0 can you help? Thanks Quote
eldon Posted March 28, 2021 Posted March 28, 2021 I would have thought that that could have been done via Properties. 1 Quote
Tharwat Posted March 28, 2021 Posted March 28, 2021 Here you go. (defun c:Ply2Lay (/ ss) (command "_layer" "_m" "SHAPE" "_c" "7" "" "_lw" "0.40" "" "") (and (setq ss (ssget "_X" '((0 . "*POLYLINE")))) ((lambda (int / sn lst pos) (while (setq lst nil int (1+ int) sn (ssname ss int) ) (foreach dxf (entget sn) (or (and (setq pos (vl-position (car dxf) '(8 40 41 43))) (setq lst (cons (cons (car dxf) (nth pos '("SHAPE" 0.0 0.0 0.0))) lst)) ) (setq lst (cons dxf lst))) ) (entmod (reverse lst)) ) ) -1 ) ) (princ) ) (vl-load-com) 1 Quote
Tharwat Posted March 28, 2021 Posted March 28, 2021 31 minutes ago, prodromosm said: Thank you Tharwat You're welcome. Quote
Guest Posted March 29, 2021 Posted March 29, 2021 Hi Tharwat. I want to ask something else about this code ,for education reasons. if i have polylines and point and hatches in layer1 , layer2 ,layer3 and i want to move only the polylines from layer 1 to layer poly-1 ,the polylines from layer 2 to layer poly-2 and the polylines from layer 3 to layer poly-3 , how to change this code (defun c:Ply2Lay (/ ss) (command "_layer" "_m" "SHAPE" "_c" "7" "" "_lw" "0.40" "" "") (and (setq ss (ssget "_X" '((0 . "*POLYLINE")))) ((lambda (int / sn lst pos) (while (setq lst nil int (1+ int) sn (ssname ss int) ) (foreach dxf (entget sn) (or (and (setq pos (vl-position (car dxf) '(8 40 41 43))) (setq lst (cons (cons (car dxf) (nth pos '("SHAPE" 0.0 0.0 0.0))) lst)) ) (setq lst (cons dxf lst))) ) (entmod (reverse lst)) ) ) -1 ) ) (princ) ) (vl-load-com) Thanks Quote
BIGAL Posted March 30, 2021 Posted March 30, 2021 (edited) Do some home work about the SSGET command and how filters work, you can have multiple filters as you want plines and a layer. A simple method would be to pick an object on desired layer and get its layer name for use with ssget. You do have 747 posts you should be by now able to do this simple modification to the very clear code provided. Edited March 30, 2021 by BIGAL Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.