If you're reading this, we've just migrated servers! If anything looks broken please email dion@thinkmoult.com :)

Approach to query multiple 2D .dwgs

I'm look for some advice on the best approach to query a large quantity (+4000) of .dwgs within our company. Historically all our 2D drawings have been created in AutoCAD, there is rich data in there which is inaccessible outside of AutoCAD.

I'm considering the approaches below to gain access to the data, any advice on the best approach would be greatly received.

1. Create custom app to query .dwg directly
2. bulk export all .dwgs as DXF/DWF
3. bulk export as .IFC and utilise BlenderBIM/IFCOpenShell to query files. (Not sure if 2D geometry can be exported to IFC?)

The chosen approach would need the query to be run over multiple files to get an aggregate of elements within all drawings.

Thanks!

Ace

Comments

  • How the "rich data" is stored in the drawings? As properties of blocks, or as text?

    If it's in blocks, I would go route 1, as complex blocks are not supported very well in dxf and in 3rd party dwg readers.
    If you want to convert them to ifc, the only Autodesk program with both ifc and decent dwg support is AutoCAD Architecture. Vanilla AutoCAD doesn't support ifc.

    Batch processing inside AutoCAD:

    • There is a method to run Dynamo scripts in AutoCAD: https://forums.autodesk.com/t5/net/integrate-dynamo-with-autocad/td-p/6674248 Dynamo comes with CPython3, so this way you can run IfcOpenShell inside AutoCAD.
    • AutoCAD recently got a python console with IronPython3 support, I don't know how well IfcOpenShell plays with IronPython. I never tried this: https://github.com/chuongmep/CadPythonShell
    • AutoLISP was the original script language of AutoCAD, still supported
    • There is VBA for AutoCAD
    • Scriptpro is an ancient tool by Autodesk, you can run a script on multiple files: Download I haven't used it in ages, I don't know if it still works, but considering the last big API change in AutoCAD was in 1997, I guess it's still working.

    If the data is just simple text, bulk export, or even opening the dwgs in a 3rd party dwg readers should work. On the wiki there is a nice list of software opening dwg files: https://wiki.osarch.org/index.php?title=Drawing_(DWG)

    dwf - or it's latest revision dwfx - is a special kind of hell, I don't recommend trying to do anything with it. Even Autodesk doesn't care about it anymore, Design Review (the official dwfx reader) hasn't been updated since 2018.

    ChubbyQuarkAce
  • edited March 2023

    Thanks! Most of the useful information will be inside blocks as attributes, so either accessing the data inside AutoCad or finding a good format to 'publish' drawings with embedded data is likely the best approach. I think Dion mentioned in the past SVGs can contain metatdata on objects, ill have a look into this.

    Good to know ifcOpenShell could be run via dynamo, could be a option to open AutoCad up to all the functions of ifcOpenShell. Some of the info. will be areas (based on polylines), im thinking area data could be extracted (and extruded to a nominal value) to generate basic volume data too.

    Edit - just found this via one of your links

    https://wiki.osarch.org/index.php?title=Scalable_Vector_Graphics_(SVG)

    Some good info. on the uses and functionality of SVG.

    Speckle (there is a AutoCad connector) is another option but I dont have AutoCad installed to test if it pushes the block data to speckle servers.

    Cheers.

    Ace
  • edited March 2023

    I didn't know about speckle's autocad connector, I played a bit with it.

    It seems block attributes are supported by speckle, but other dynamic block features aren't. New block definitions are created in Speckle from different custom parameter values, so dynamic blocks looks the same as in Autocad, but the parameter values are not accessible. I guess it's a limitation on AutoCAD's side, and Speckle cannot solve it, as dynamic blocks behave the same way in every dwg readers, and you cannot access those values via the API.

    If you need the dynamic block values as well, you can export them with DATAEXTRACTION to excel or csv, and then pair them later somewhere else.

    Edit: I just added the most important info from this thread to the wiki page of AutoCAD: https://wiki.osarch.org/index.php?title=AutoCAD

    Acejsdbroughton
  • Oh, that's good to know. Great to have the wiki page for future reference as we have a great deal of useful historic (and some current) data embedded in .dwgs.

Sign In or Register to comment.