Jump to content

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


Recommended Posts

I found a lisp to remove the standards (thanks Lee Mac) but would like to do the opposite.

code to remove

(defun c:test (/ DictObj)

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

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


I would like to add the (DWS) file from a network location.


Any help would be appreciated.

Link to comment
Share on other sites

Try this snippet and tell me...


(defun c:adddws ( / dws dictionary xname newdict datalist )
 (setq dws (getfiled "Select DWS file" "" "dws" 4))
 (setq dictionary (list '(0 . "DICTIONARY") '(100 . "AcDbDictionary")))
 (setq xname (entmakex dictionary))
 (setq newdict (dictadd (namedobjdict) "AcStStandard" xname))
 (setq datalist (append (list '(0 . "XRECORD") '(100 . "AcDbXrecord")) (list (cons 1 dws))))
 (setq xname (entmakex datalist))
 (dictadd newdict "0" xname)



Link to comment
Share on other sites

It does prompt for location, However I would like to hardcode the network location and the DWS file name.

I would like to add the standards file without a prompt.

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.

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