Run Dynamo Script on entire folder of dwg's

Thanks Paolo, that was it.

1 Like

C# programmer here… comes to look at dynamo… within first minute of dynamo use, notices that you need to use friggin python to import external dwgs… closes dynamo… never opens it again…

actually comes back to dynamo briefly… to check if compiled dll’s can be utilized within dynamo to expand its functionality… like load a bunch of files…? anyone know if that’s readily possible?

not bad for your first post :slight_smile: C# programmer here too, love Dynamo and respect your opinions.
First, to import DWG as Block there is a dedicated node.
Second, Zero Touch is a common way to create nodes to customize functionalities in Dynamo Zero Touch Plugin Development · DynamoDS/Dynamo Wiki · GitHub

What’s not to like about Python? if it’s the IDE in Dynamo I agree, but you can use an external editor and have the same features you have in Visual Studio when working with .NET

1 Like

Paolo,

Hope all is well my friend. I am working on tweaking the whole folder of dwg’s script that you helped me with (and many people have said helped them going through our posts online). I was looking to do a similar thing but import a Page Layout instead of erase and insert block. Have you seen anybody so something similar to that?

The issue is that with Europe adopting IFC format, many Arch’s and Eng’s need to export to vanilla AutoCAD dwg’s and import the IFC page layout.

Thank You,

@kievskydv The official forum language is English. This is a requirement to make search work. Please post with a translation as I edited you post above accordingly in the future.

I was doing that 30 years ago. I used AutoLISP to write a script that opened a list of DWGs with whatever commands, including LISP functions, and saved. Then I’d simply run the script.

@Paolo_Emilio_Serra1
I need to replace the block in a layout / paper space. can you update the script to use in paper space.

1 Like

In my original code you need to target the paper space rather than the model space when you are defining the BlockTableRecord (btr, line 134)

1 Like

Please can you give me a line of code for paper space.

BlockTableRecord.PaperSpace

this returns the last Layout that was active. You can loop through all the layouts via LayoutManager Help

1 Like

Hi Everyone,

This was a great thread to follow. I’m also trying to talk to a folder of drawings to extract information from DWGs and this has been a huge help. Nice work!

For some reason though, when I download the final dynamo file, I only see a small portion of the file. @Paolo_Emilio_Serra1 could this be something to do with IronPython? I was having some problems with the python 3.10 installation, and uninstalled IronPython, forgetting that it was part of the Dynamo installation.

I re-installed IronPython, and python scripts that I write inside Dynamo work fine, but all I see when I open your dyanmo file is what’s in the attached screenshot. Are you able to share the python separately? It would be much appreciated!

Thanks and have a great day,

Michael

@nick.turner66KAP there are some new nodes in Camber v2.0.0 that might help with this. I’d be interested to hear your feedback.

9 Likes

Hey All,

I am working on a modification of the great Dynamo Script that Paolo developed for running on a folder of DWGs. I have an error occuring, and was hoping that someone might be able to take a look and see what portions of the code I need to adjust.

The script I currently have copies the Layout1 tab of a DWG (which already contains a viewport) and then sets the viewport parameters of the newly copied tab based on user input. I have been working on merging that function with the other function to enable running this script on an entire folder of DWGs.

When I run my current code, the output success list is filled, and there are zero entries in the failure list. However, the viewport function is not applied to all of the DWGs in the folder. The function is only being applied to the first DWG in the folder.

The function to copy the Layout and update viewport parameters works fine on a single drawing as a standalone python script. The issue happened when I attempted to merge that code in with your code to operate on an entire folder.

I will attach my .xlsx, .dyn, and a .dwg for review…

Part Catalog Test Drawing Sheet2.dwg (650.0 KB)
JJH_CreateGrid.xlsx (8.9 KB)
BVSPC_ImportGridInformation_rev0.dyn (74.3 KB)

Thank you for your time. It is very much appreciated.

Does this script create a log file? Can anyone help me locate the log if it is creating one? The problem still persists for me.