Jump to content

Explode only ORDINATE Dimensions Using LISP


Recommended Posts

Posted

Hey guys,

 

I have a need to explode all ORDINATE dimensions (X and Y) in a DWG. I thought this would be simple enough but I cannot get the selection set filter list to work.

 

My code is:

 

(defun c:eo ()
(setq ss (ssget "X" '((70 . 6))))
(command "explode" ss)
(princ)
)

 

Just wondering if any of you guys could please take a look and let me know where I am going wrong?

 

Thanks a lot.

Posted (edited)

(ssget "_x"
      '((0 . "DIMENSION") (-4 . "<OR") (70 . 38) (70 . 102) (70 . 166) (-4 . "OR>"))
)

 

Oops.. :) mis-read the title :)

 

(if (setq 
         ss  (ssget "_x" '((0 . "DIMENSION")))
   )
 (repeat (setq i (sslength ss))
          (if (Eq (vla-get-ObjectName (vlax-ename->vla-object (setq e (ssname ss (setq i (1- i))))))
                  "AcDbOrdinateDimension"
              )
            (command "_explode" e )
          )
        )
        
 )

Edited by pBe
Posted (edited)

Thanks a lot for the reply pBe.

 

The AutoLISP code you provided does work, but only on one item at a time. I cannot see any glaring reason as to why this may be… I’m afraid I don’t understand the Selection Set Filter List you have provided.

 

My partially working code is:

 

(defun c:eo ()
(setq ss (ssget "_x" '((0 . "DIMENSION") (-4 . "<OR") (70 . 38) (70 . 102) (70 . 166) (-4 . "OR>"))))
(command "EXPLODE" ss)
(princ)
)

 

Can you see a reason which would be causing the routine to only operate on single items?

 

Thanks for your help mate.

Edited by lamensterms
Posted
(defun c:eo ()
[b]  (setvar 'qaflags 1)[/b]
 (if (Setq ss (ssget "_x" '((0 . "DIMENSION") (-4 . "<OR") (70 . 38) (70 . 102) (70 . 166) (-4 . "OR>"))))
  (command "_explode" ss ""))
            
[b]  (setvar 'qaflags 0)[/b]
(princ)
)

Posted

I hope that none of the selected dimensions would be on a locked layer . :roll:

Posted

Awesome, thanks a lot for that pBe.

 

Tharwat - Most of the time this routine will be used immediately after adding the ordinate dimensions, so hopefully they will never be on locked layers.

 

Thanks guys.

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