Globally change the associated standards file

Globally change the associated standards file

debi_olson
Enthusiast Enthusiast
923 Views
5 Replies
Message 1 of 6

Globally change the associated standards file

debi_olson
Enthusiast
Enthusiast

Our network mapping has changed and I'd like to be able to globally change the path/file associated with the standards file for our drawings. The idea that I have to do that to each drawing individually is both daunting and annoying. I don't care if it's a lisp or if there is already a command or variable that I just can't find. If it's a lisp I would hope that it could be part of the startup/load and run behind the scene, requiring no input from the end user. If someone is willing to guide me a bit I'd love to write it myself if there isn't already a method to do this in place (and it would surprise me if there isn't). I can't believe I'm the first one to have this issue.

 

Thank you for any help,

Debi

0 Likes
924 Views
5 Replies
Replies (5)
Message 2 of 6

ChicagoLooper
Mentor
Mentor

You may try AutoCAD reference Manager. Go here:

Start -> All Programs -> Autodesk -> AutoCAD 20XX -> Reference Manager

(If you can't find it, click start button and type in Reference Manager in the search box.)

 

To find out how to use it to change a drive letter here's a video by Jason Drew.

<iframe width="640" height="620" src="https://screencast.autodesk.com/Embed/Timeline/4dce84fd-f00e-4... 

Chicagolooper

EESignature

0 Likes
Message 3 of 6

debi_olson
Enthusiast
Enthusiast

Thank you. It functionally works to solve the issue but the down side is that it redates all of the files. For our vault copies this isn't an issue but for the drawings actively in play it makes them more difficult to age. This is particularly relevant to construction files as currently our file management is still very manual.

 

I'm still hoping to build a lisp that will take care if it as files are opened. I need to follow up on that part.

 

Thanks again for the help!

Debi

0 Likes
Message 4 of 6

ChicagoLooper
Mentor
Mentor

From your original explanation you wanted to globally change the path-file associated with the standards file for our drawings. But in your latest post you said, "For our vault copies this isn't an issue but for the drawings actively in play it makes them more difficult to age. This is particularly relevant to construction files as currently our file management is still very manual." I would think you'd want the opposite: to NOT CHANGE the drawings in the vault and DO CHANGE the drawings actively in play.

 

Say, for example, you want to grab a polygon which represents a former building footprint from a drawing in your vault. You open the drawing, copy the polygon, and then follow it up by pasting the footprint into your current drawing. Once the vault drawing is opened, the drawing updates by your lisp that conveniently runs in the background. Even though the old drawing was never updated or modified, it was simply opened to access the former building footprint, the drawing was updated and saved with the new standard, which in turn, would have 'aged' your drawing, and aging it this way, at least to me, is totally unnecessary.  

 

If this is what you want, then your lisp will do just fine. But if it isn't, you'd rather perform indiscriminate updates, only to the drawings you choose, then the reference manager will serve you better. 

Chicagolooper

EESignature

0 Likes
Message 5 of 6

debi_olson
Enthusiast
Enthusiast
We don't actually modify the drawings in the vault. We make a copy and work on that. Therefore having it update when we opened it to work on it would be perfect. I wouldn't (and haven't) updated the drawings in the vault because there is no actual need to. They would update as we created new revisions. I can see how my comment about the vault copies would be confusing as written. I meant that the date changing on the file would have no visible downside, whereas with aging construction documents it is.



Thank you for your response.


0 Likes
Message 6 of 6

DannyNL
Advisor
Advisor

A long...long time ago, we'd the same problem and I've written something to change/repair the path or remove the path of attached drawings standards at startup/opening of a drawing depending on your need. The code could probably could be optimized to reduce te number of lines and variables, but it does the trick.

 

(defun RepairStandards (RS_SearchPath / RS_Dictionaries RS_Standard_Dictionary RS_FileName RS_FileFound RS_XRecordDataType RS_XRecordDataValue)
   (setq RS_Dictionaries (vla-get-Dictionaries (vla-get-ActiveDocument (vlax-get-acad-object))))
   (setq RS_Standard_Dictionary (vl-catch-all-apply 'vla-item (list RS_Dictionaries "AcStStandard")))
   (if
      (not (vl-catch-all-error-p RS_Standard_Dictionary))
      (progn
         (vlax-for RS_Standard RS_Standard_Dictionary
            (vla-GetXRecordData RS_Standard 'RS_Standard_Marker 'RS_Standard_Name)
            (setq RS_FileName (vlax-variant-value (nth 0 (vlax-safearray->list RS_Standard_Name))))
            (if
               (not (findfile RS_FileName))
               (progn
                  (setq RS_FileName (strcat (vl-filename-base RS_FileName) (vl-filename-extension RS_FileName)))
                  (if                     
                     (or
                        (and
                           (= (type RS_SearchPath) 'STR)
                           (setq RS_FileFound (findfile (strcat (vl-filename-directory RS_SearchPath) "\\" RS_FileName)))
                        )
                        (setq RS_FileFound (findfile RS_FileName)) 
                     )
                     (progn
                        (setq RS_XRecordDataType  (vlax-safearray-fill (vlax-make-safearray vlax-vbInteger '(0 . 0)) '(1)))
                        (setq RS_XRecordDataValue (vlax-safearray-fill (vlax-make-safearray vlax-vbVariant '(0 . 0)) (list (vlax-make-variant RS_FileFound vlax-vbString))))
                        (vla-SetXRecordData RS_Standard RS_XRecordDataType RS_XRecordDataValue)                           
                     )                     
                     (princ (strcat "\n** Standard: " RS_FileName " cannot be repaired automatically. Please fix path manually!"))                     
                  )
               )
            )
         )
      )
      (progn
         (princ"\n*** No standards attached!")
      )
   )
   (vlax-release-object RS_Dictionaries)
   (princ)
)

(defun UnpathStandards (/ US_Dictionaries US_Standard_Dictionary US_FileName US_FileFound US_XRecordDataType US_XRecordDataValue)
   (setq US_Dictionaries (vla-get-Dictionaries (vla-get-ActiveDocument (vlax-get-acad-object))))
   (setq US_Standard_Dictionary (vl-catch-all-apply 'vla-item (list US_Dictionaries "AcStStandard")))
   (if
      (not (vl-catch-all-error-p US_Standard_Dictionary))
      (progn
         (vlax-for US_Standard US_Standard_Dictionary
            (vla-GetXRecordData US_Standard 'US_Standard_Marker 'US_Standard_Name)
            (setq US_FileName (vlax-variant-value (nth 0 (vlax-safearray->list US_Standard_Name))))
            (if
               (setq US_FileFound (findfile US_FileName))
               (progn
                  (setq US_FileName (strcat (vl-filename-base US_FileName) (vl-filename-extension US_FileName)))
                  (setq US_XRecordDataType  (vlax-safearray-fill (vlax-make-safearray vlax-vbInteger '(0 . 0)) '(1)))
                  (setq US_XRecordDataValue (vlax-safearray-fill (vlax-make-safearray vlax-vbVariant '(0 . 0)) (list (vlax-make-variant US_FileName vlax-vbString))))
                  (vla-SetXRecordData US_Standard US_XRecordDataType US_XRecordDataValue)                           
               )                     
               (princ (strcat "\n** Standard: " US_FileName " cannot be repaired automatically. Please fix path manually!"))                     
            )
         )
      )
      (progn
         (princ"\n*** No standards attached!")
      )
   )
   (vlax-release-object US_Dictionaries)
   (princ)
)
0 Likes