Jump to content
vernonlee

HELP to include "AcDbAlignedDimension" code for a "Dimension deleting" LISP

Recommended Posts

vernonlee

Anyone can help to see where i can insert "AcDbAlignedDimension" to allow aligned dimension to be deleted as well.

 

Got this LISP from another website.

 

Thanks

 

;;  DELETE DIMENSION BASE ON SELECTIVE BLOCKS   ;;
(defun c:DIMDELS (/ ss i sn name lst)
 (vl-load-com)
;;;        ------ Tharwat 15. June. 2012 -----      ;;;
;;; codes to delete all dimensions entities in the  ;;;
;;;                selected blocks                  ;;;
 (if (not acdoc)
   (setq acdoc (vla-get-activedocument (vlax-get-acad-object)))
 )
 (if (setq ss (ssget "_:L" '((0 . "INSERT"))))
   (repeat (setq i (sslength ss))
     (setq sn (ssname ss (setq i (1- i))))
     (if (not (member (setq name (cdr (assoc 2 (entget sn)))) lst))
       (progn
         (setq lst (cons name lst))
         (vlax-for each (vla-item (vla-get-blocks acdoc) name)
           (if (eq (vla-get-objectname each) "AcDbRotatedDimension")
             (vla-delete each))
         )
       )
     )
   )
   (princ)
 )
 (if ss (vla-regen acdoc AcAllviewports))
 (princ)
)

Share this post


Link to post
Share on other sites
Tharwat

Replace the highlighted object name as per the one you want to change .

(if (eq (vla-get-objectname each) "[color="blue"]AcDbRotatedDimension[/color]")
      ...
    ...

Share this post


Link to post
Share on other sites
vernonlee
Replace the highlighted object name as per the one you want to change .

 

I have tested that previously & yes it works.

 

To clarify, I am not sure how to but what I would like to is to have both to be included in the LISP. Possible?

Share this post


Link to post
Share on other sites
Tharwat
I have tested that previously & yes it works.

 

To clarify, I am not sure how to have both to be included in the LISP. Possible?

 

Yes , replace it with this .

 

(if (wcmatch (vla-get-objectname each) "AcDbRotatedDimension,AcDbAlignedDimension")
........

Share this post


Link to post
Share on other sites
vernonlee

Thanks Tharwat. It works.

 

Apologies I forgotten that i wanted to include angled dimension as well. I can only find the code for aligned dimension but not for angle. Any advise on that?

Share this post


Link to post
Share on other sites
Tharwat
Thanks Tharwat. It works.

 

You are welcome .

 

Apologies I forgotten that i wanted to include angled dimension as well. I can only find the code for aligned dimension but not for angle. Any advise on that?

 

Add the following as I did in the last modification .

 

"AcDb2LineAngularDimension"

 

I have just saw your PM into the other forum , anyway I am just following your request here :)

Share this post


Link to post
Share on other sites
vernonlee

Thanks bro for your help :)

 

PMed you at the other forum at first. Did not know you are active here as well

Share this post


Link to post
Share on other sites
Tharwat
Thanks bro for your help :)

 

PMed you at the other forum at first. Did not know you are active here as well

 

You are welcome :)

Share this post


Link to post
Share on other sites
vernonlee

Found out can add the following as well. :D

 

AcDbRadialDimension

AcDbDiametricDimension

Share this post


Link to post
Share on other sites
vernonlee

It now deletes every dimension known to man :lol:............ except Arch Length :ouch:

 

EDIT

Just found the answer

 

AcDbArcDimension

Share this post


Link to post
Share on other sites
Tharwat

Are you after deleting all dimension objects in blocks ?

Share this post


Link to post
Share on other sites
vernonlee

Yes Tharwat. Base on selective blocks.

Share this post


Link to post
Share on other sites
Tharwat
Yes Tharwat. Base on selective blocks.

 

So just replace all the previous object names with this one .

 

AcDb*Dimension

Share this post


Link to post
Share on other sites
vernonlee

Thanks Tharwat. Learn a bit more everyday :)

Share this post


Link to post
Share on other sites
Tharwat
Thanks Tharwat. Learn a bit more everyday :)

You're welcome :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×