Jump to content

Recommended Posts

Posted

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))

  • Replies 24
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    12

  • ksperopoulos

    7

  • David Bethel

    6

Posted

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)
)

Posted
:) Thanks. Your "new code" is a lot easier on the eyes for a guy STILL learning this stuff!
Posted
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

Posted
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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...