Jump to content

Delete ALL Custom Properties - Help!


ILoveMadoka

Recommended Posts

My desire was to simply delete all custom properties regardless of name or order or information. 

 

I found this code here

 

(setq sinfo (vla-get-SummaryInfo (vla-get-ActiveDocument (vlax-get-acad-object))))

;; remove custom infos
(repeat (setq n (vla-NumCustomInfo sinfo))
(vla-RemoveCustomByIndex sinfo (setq n (1- n)))
)

(foreach prop '(Author Comments Hyperlinkbase
Keywords LastSavedBy RevisionNumber
Subject Title
)
(if (vlax-property-available-p sinfo prop T)
(vlax-put-property sinfo prop "")
)
)

 

It does eventually delete all the custom properties but it opens the drawing properties dialog first then opens the purge dialog 3 times (in the current dwg).
Can some please help me clean this up such that it only deletes all the custom properties without all the annoying extras?
My desire is a (defun c:xxx that I can run clean.

 

Does the

(foreach prop

above relate to specific property names?
I do not have those specific properties per se

 

Link to comment
Share on other sites

No where in that code is PURGE used? I just tried it here and it works without any popups.

 

You should have the (foreach prop .. 

image.thumb.png.24e23d392e08eed3af427301e55a8a5b.png

Link to comment
Share on other sites

I have no idea.
Purge was not in my history either...

In the meantime I came up with this... (works for me)

 

(defun C:DCF (/ App Doc DwgProps)
  ;;; Delete all Custom Fields
  (setq App (vlax-get-acad-object)
        Doc (vla-get-ActiveDocument App)
        DwgProps (vla-get-SummaryInfo Doc))

  (repeat 
    (setq n (vla-NumCustomInfo DwgProps))
    (vla-RemoveCustomByIndex DwgProps (setq n (1- n)))
  )

  (princ)
)

 

Link to comment
Share on other sites

I have found <personally> that sometimes when I paste code in at the command line that I get weirdness..
I should have put into in a file and then try loading it..

 

any way I'm good.

Edited by ILoveMadoka
Link to comment
Share on other sites

5 minutes ago, ILoveMadoka said:

I have found <personally> that sometimes when I paste code in at the command line that I get weirdness..
I should have put into in a file and then try loading it..

@ILoveMadoka if you use VLIDE from ACAD, you can LOAD to test as many program lines 

 

image.thumb.png.a2317fee6345e07345a44c846a915135.png

Link to comment
Share on other sites

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