Jump to content

Can you delete (DWS) files with a LISP routine?


Recommended Posts

Posted

My company uses the AutoCAD Standards Checker. We have a DWS file associated with the border and when we submit drawings to our client every drawing has to have them removed. I’m looking for a lisp routine that will uninstall the DWS files if there is any. Can anyone help?

Posted

I have to open every drawing then do one of the two methods below; Tool Bars: Tools/Cad Standards/Configure or Command Line: standards. Once the dialog box comes up pick on the loaded standard (if the drawing has any, some don’t) then hit the (X) button which removes the standards (DWS file) from the drawing. Save the drawing, close it, open the next drawing and repeat.

I found a Batch routine that opens every drawing in a folder and runs a clean up LISP on the drawings, but I need to add this to it. Having trouble and would appreciate any help.

Posted

i don't use them but you might try setting the system variable STANDARDSVIOLATION to 0

Posted
I have to open every drawing then do one of the two methods below; Tool Bars: Tools/Cad Standards/Configure or Command Line: standards. Once the dialog box comes up pick on the loaded standard (if the drawing has any, some don’t) then hit the (X) button which removes the standards (DWS file) from the drawing. Save the drawing, close it, open the next drawing and repeat.

 

I found a Batch routine that opens every drawing in a folder and runs a clean up LISP on the drawings, but I need to add this to it. Having trouble and would appreciate any help.

does purge remove the dws file?

Posted

Nope, purge doesn’t work on them. Have to type (standards) at the command line, pick the file, and then hit the (X) button to delete them. Sucks when your dealing with a couple hundreds drawings. That’s why I’m hoping some one knows how to write a LISP or something that can deal with this.

Posted

Here is the code I found on the internet but it doesn't work, well it may work, but not what I want it to do. I'm not sure what it does, becasue I do not understand this code.

 

 
(vl-load-com); Doc is the document (drawing) you want to erase all DWS file associations.
(defun DeleteDWSDict (Doc / DictObj)
(if
(not
 (vl-catch-all-error-p
  (setq DictObj
   (vl-catch-all-apply
    'vla-Item
    (list
     (vla-get-Dictionaries Doc)
     "AcStStandard"
    )
   )
  )
 )
)
(progn
 (prompt (strcat "\n Deleted " (itoa (vla-get-Count DictObj)) " DWS file associations."))
 (vla-Delete DictObj)
)
(prompt "\n No attached DWS files.")
)
(princ)
)

Posted

Maybe I’m missing something but why do you need to get rid of the standard?

If you save the clients copy to a file then run a batch script that turns the system variable standardsviolation to 0 then the client can do anything to the drawings with out any nag screens.

Posted

Company process, It’s what we have to do, not sure why. Maybe to reduce file size, so it doesn’t show up in e-transmit, who knows... It’s what we’re told to do.

Posted
Here is the code I found on the internet but it doesn't work, well it may work, but not what I want it to do. I'm not sure what it does, becasue I do not understand this code

 

It just deletes the AcStStandard Dictionary - I didn't know that the standards were stored there, and have no way of testing it, but I can provide you with a function to do so:

 

(defun c:test (/ DictObj)
 (vl-load-com)

 (if (not (vl-catch-all-error-p
            (setq DictObj (vl-catch-all-apply 'vla-item
                            (list (vla-get-Dictionaries
                                    (vla-get-ActiveDocument
                                      (vlax-get-acad-object))) "AcStStandard")))))
   (progn
     (princ (strcat "\n<< Deleted " (itoa (vla-get-Count DictObj)) " DWS File Associations >>"))
     (vla-Delete DictObj))

   (princ "\n<< No Attached DWS Files >>"))
 
 (princ))

Posted

Lee,

 

Thank you so so so much!!! I added it to my cleanup LISP and it works like a charm. I wish I have half your knowledge of LISP routines. It really sucks to rely on other peope to do your job, thanks again for taking the time and helping me!!!

 

Rob

Posted

You're very welcome Rob - I'm happy to have helped out - you provided most of the code after all :)

  • 4 years later...
Posted

If you wanted to reverse this and add the dictobj how could you?

(progn
     (princ (strcat "\n<< Deleted " (itoa (vla-get-Count DictObj)) " DWS File Associations >>"))
     (vla-add DictObj))

I would add the file from a network location. (example)

//drive/folder/standards.dws

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