ksperopoulos Posted December 5, 2012 Author Posted December 5, 2012 Lee Mac, I made a couple changes to focus on a few layers and raise them to a set elevation instead of being prompted. While it seems to work, do you see anything that I should change to make it work 100% of the time? (defun c:zMov (/ ss z) (vl-load-com) (if (and (setq ss (ssget "_x" '((8 . "M-*-DIMS,M-*-ELEV,M-*-SIZE,M-*-TEXT,P-*-DIMS,P-*-ELEV,P-*-SIZE,P-*-TEXT")))) ) (progn (setq Obj (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))) (foreach x Obj (foreach i '(1e99 -1e99) (vla-move x (vlax-3D-point '(0 0 0)) (vlax-3D-point (list 0 0 i))))) (mapcar (function (lambda (x) (vla-move x (vlax-3D-point '(0 0 0)) (vlax-3D-point (list 0 0 600))))) Obj)) (princ "\n<< Incorrect Selection >>")) (princ)) Quote
Lee Mac Posted December 5, 2012 Posted December 5, 2012 Wow - that is some old code! Although probably not as quick, it may be clearer and more intuitive to use: (defun c:zmov ( / s ) (if (setq s (ssget "_X" '((8 . "[PM]-*-*") (8 . "*DIMS,*ELEV,*SIZE,*TEXT")))) (command "_.move" s "" "_non" '(0.0 0.0 0.0) "_non" '(0.0 0.0 1e99) "_.move" s "" "_non" '(0.0 0.0 0.0) "_non" '(0.0 0.0 -1e99) "_.move" s "" "_non" '(0.0 0.0 0.0) "_non" '(0.0 0.0 600.0) ) (princ "\nNo objects found.") ) (princ) ) Quote
ksperopoulos Posted December 5, 2012 Author Posted December 5, 2012 Thanks. Your "new code" is a lot easier on the eyes for a guy STILL learning this stuff! Quote
David Bethel Posted December 5, 2012 Posted December 5, 2012 Wow - that is some old code! (defun c:zmov ( / s ) (if (setq s (ssget "_X" '((8 . "[PM]-*-*") (8 . "*DIMS,*ELEV,*SIZE,*TEXT")))) (command Lee, I don't thing that I've ever seen an ( ssget ) call using group 8 twice.. I don't quite understand the logic. -David Quote
Lee Mac Posted December 5, 2012 Posted December 5, 2012 I don't thing that I've ever seen an ( ssget ) call using group 8 twice.. I don't quite understand the logic. -David Since the ssget filter list has an implied AND logic for all entries in the list, my filter is the equivalent of: (and (wcmatch <layer name> "[PM]-*-*") (wcmatch <layer name> "*DIMS,*ELEV,*SIZE,*TEXT") ) Or, alternatively: (wcmatch <layer name> "[PM]-*-*DIMS,[PM]-*-*ELEV,[PM]-*-*SIZE,[PM]-*-*TEXT") But that's too much typing I'm happy to explain further if the above is unclear. 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.