lisp code to delete all dim objects and dim styles.

lisp code to delete all dim objects and dim styles.

GeryKnee
Advocate Advocate
2,012 Views
5 Replies
Message 1 of 6

lisp code to delete all dim objects and dim styles.

GeryKnee
Advocate
Advocate

Hello,

I need a lisp function that deletes all dimension objects from drawing, everywharw there are and the dimension styles.

Gery.

0 Likes
Accepted solutions (1)
2,013 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

The (command "SELECTSIMILAR") Does not work?

 

 

 

Júnior Nogueira.

Por favor,  Aceitar como Solução se meu post te ajudar.

Please Accept as Solution if my post helps you

0 Likes
Message 3 of 6

pbejse
Mentor
Mentor
Accepted solution

@GeryKnee wrote:

 ...deletes all dimension objects ... the dimension styles.

Gery.

 

(defun c:demo (/ aDoc)
  (setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
  (if (tblsearch "DIMSTYLE" "Standard")
    (command "-DIMSTYLE" "R" "Standard")
  )

  (vlax-for blk	(vla-get-blocks aDoc)
    (if
      (eq :vlax-false (vla-get-isXref blk))
       (vlax-for h blk
	 (cond
	   ((and (vlax-write-enabled-p h)
		 (vl-string-search "Dimension" (vla-get-ObjectName h))
	    )
	    (vla-delete h)
	   )

	 )
       )
    )
  )
  (repeat 4 (vla-purgeall aDoc))
)
(vl-load-com)

HTH

 

Message 4 of 6

john.uhden
Mentor
Mentor

HTH is what I used to use to chlorinate my swimming pool.  🙂

Now I use something like 98% tri-chloro-dimescaline tablets (or something like that).

John F. Uhden

0 Likes
Message 5 of 6

AIR_123
Collaborator
Collaborator

@pbejse wrote:

@GeryKneewrote:

 ...deletes all dimension objects ... the dimension styles.

Gery.

 

(defun c:demo (/ aDoc)
  (setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
  (if (tblsearch "DIMSTYLE" "Standard")
    (command "-DIMSTYLE" "R" "Standard")
  )

  (vlax-for blk	(vla-get-blocks aDoc)
    (if
      (eq :vlax-false (vla-get-isXref blk))
       (vlax-for h blk
	 (cond
	   ((and (vlax-write-enabled-p h)
		 (vl-string-search "Dimension" (vla-get-ObjectName h))
	    )
	    (vla-delete h)
	   )

	 )
       )
    )
  )
  (repeat 4 (vla-purgeall aDoc))
)
(vl-load-com)

HTH

 


Great lisp! Thanks a lot!
How can it be optimized to also delete other styles, with possibility to delete by selection or style type? Thanks in advance!

0 Likes
Message 6 of 6

Sea-Haven
Mentor
Mentor

You need to look into how to delete a dictionary entry, a simpler way is -purge look at the options.

0 Likes