Rename XREFs in multiple dwgs

Not crazy at all. Even player is a stretch sometimes.

Should work fine in player. Just change the name of the “bool” nodes to, “Include XREF?” and right click them and click “is input”. Do the same to the “CAD” folder path node.


If you want them to exclusively use the player and they need to add xrefs that aren’t listed in your bool toggles. They can add the name of the xrefs to a string node like this.
XrefUpdates-V3.dyn (80.5 KB)


Awesome that worked… but where is it XREFing them to? it did not seem to XREF them into any dwgs?
We need to be able to select the Destination Drawing Set folder. Sometimes it is the Construction Folder with the sheets. Sometimes we want to do the Site Plan folder sheet dwgs, etc… Issue there may be dwgs in there we do not want to XREF everything into, like the Border.dwg or the Cx.x General Notes.dwg, etc… Still think it may be good if the destination was just the open dwg.
Also, see image for errors.

You aren’t wrong, as both users and management are somewhat intimidated. That said 10 years from now those companies will feel the same way the Architecture firms doing their work in CAD instead of BIM feel today - we can’t compete because we don’t . It’s a technically shift which will take many by surprise.

1 Like

Here is an update:
XrefUpdates-V3.dyn (87.1 KB)

It will attach the xrefs that have the bool flipped to true and any additional ones that contain the strings passed with commas between them into the dynamo player, into all DWGs in the the “Drawing Sets” folder and any subfolders within it.

1.) I added another input which allows you to exclude the attachment to drawings in the “Drawing Sets” folder by string. So if you don’t want to attach the xrefs to a file named “General Notes.dwg” you can just add “Notes” as one of the strings in the dynamo player.

Now someone can use the two string inputs to add any xrefs that aren’t listed in the bool toggles or to filter out submittalDWGs from getting attached to.

2.) You are getting an error because the file directory you provided me had a “lighting” folder but the code couldn’t find a “lighting” folder in your directory. I added a try, except statement to handle this.

3.) You do not have ironpython2 installed. ironpython2 does not come built in anymore and has to be installed. You need ironpython2 to attach xrefs because of @jacob.small 's previous comment:

The reason for the issue is that CPython can’t generate classes in the same way as IronPython because in it’s case the call from inside the house. Basically you’re already in .net, so creating a class won’t work without creating an instance, and you can’t create an instance without the class… It gets somewhat messy in Revit but from what I am seeing it’s VERY messy in AutoCAD. The CPython feedback thread has more technical info if you’re interested.

2 Likes

Nice work Shaun! Keep it up :muscle:

4 Likes

This is great. One more issue. It does not seem to know if the dwg opens (was last saved) in Paperspace or Modelspace. If the dwg was last saved in PSpace, then it XREFs the base files into PSpace, making quite the mess. Is there a way to switch to Model Space before XREFing. Also, the destination folder is important. We may have different XREFs for the Site Plan folder then we have for the Construction folder. Maybe, just an exclude, like you did for files, but have one that excludes folders in the “Drawings Sets” folder. Thank you again, this is going to an awesome addition to our workflow.

No problem. Happy its working on your end. Okay I will look into switching to model space and add a filter for folders in the drawing set folder.

Could either filter out based on a list of folders to exclude or only include folders based on a list. I’m thinking that the exclusionary list will be better but what would you prefer?

Okay, revised. This will now xref into model space regardless of what layout the drawing is in. I also added another input for removing folders in the drawing sets folder that you don’t want to attach to.

XrefUpdates-V3.dyn (89.9 KB)

FYI there might be some helpful nodes for this in the Camber package starting in v4.0.0.

3 Likes

Thank you for the heads up. Those look awesome. I deployed Camber 4.0.0 for the company, but we will probably use the dyn Shaun helped create for this. I have tweaked it to have more friendly inputs, and it works well. He does have an IronPython2 block in there that may need to be replaced at some point.

2 Likes

Greetings,
We have been using the attached dyn (pretty much the same as the one you created) successfully, and are much appreciative for you help. I apologize for still not learning Python and was hoping you could help edit the python code block to check and see if the XREF already existed in the destination before XREFing it in. We have had users run it more than once resulting in the same XREF being in the destination dwg(s) multiple times. Thank you!

XREF Base Files To Sheet dwgs.dyn (130.9 KB)

1 Like

A post was split to a new topic: Xref multiple DWGs

I would like to ask whether DYNAMO can take effect in multiple files at the same time? :joy:

Nope, sadly not. Only on one file at a time

@btillett Hi
Thanks for sharing dynamo.
Your dynamo script working on model or cutsheet file in same folder of xrefs.
I tried to fix this dynamo to be able to read multiple cutsheets in separate folder and to import or reload path for xrefs from another folder but it didn’t work.
Appreciate if you can double check
XREF Base Files To Sheet dwgs.dyn (70.8 KB)