I was wondering what it takes to build some dynamo nodes able to interact with AutoCAD and Civil 3D.
We are building a workflow (similar to the bridge package) to bring information from Civil to Revit and completely “BIMize” our project.
I would like to automate it further by directly accessing the civil 3D document instead of having to export a report of points, manually set the range of a particular section on the alignment and so on.
I imagine nodes of the type “get document alignments”, “get alignment profiles”, “get elevation at station”, “get point at station, offset, elevation” (and vice versa), “get surface/profile name/description”, “get corridor”, “get corridor regions”, “get regions properties” and so on.
After some research I figured out that I cannot control AutoCAD/Civil with .net api from an outside process, so the options are:
1 - write the nodes with the Interop library/ COM API (unmanaged c# or python)
2 - use some IPC techniques (WCF? WEB api? simple Named Pipes?) and write a .NET AutoCAD/Civil Plugin that act as a server for the Nodes calls.
3- Use Teigha Civil as library (if I understood correctly what is capable of)
#1 can be really slow, and since everyone is saying I should avoid COM, then so be it. But #2 seems like a lot of work to me, especially because I never did any IPC. #3 could be the best options, but relies on closed source libraries (and it’s an investment I need to justify to my boss).
Is there a magic wand to expose all the AutoCAD .NET API via some IPC mechanism?
Did you come up with better solutions?
2 Likes
Hi,
It seems like you’ve already had a lengthy discussion on this topic somewhere before. The only way to get relevant feedback is if you link to that earlier discussion, otherwise all you’ll just end up with a rehash of it.
COM interop might be the slowest solution from an execution perspective, but will be the easiest one development wise. If getting results is your main goal I don’t see why you can’t do this with activeX.
We have a similar problem. Trying to get Civil3D bridge alignments into Dynamo. Our input is XML.
Basically, I’d like to duplicate the functionality of the Civil Structures plugin for importing alignment and then expand it through Dynamo.
I managed to get XML information (although not in a very flawless way), but then the alignments sometimes have CircCurves and spirals (clothoid curves) which I don’t know how to get into dynamo.
Revit/Dynamo does not deal with geometry such as clothoids & cubic parabola very well
I’d say the best you could get would be an approximation of these geometry types either by faceting or curves rather than a mathematically correct object.
As a plug for my blog: https://hannellbim.com/2016/06/04/bim-infrastructure/
talks about this
Andrew
1 Like
Yep Revit does not work well with these. So the perfect idealistic solution for me would be approximating these while extracting the data from the XML. I guess Civil Structures does something similar, but I don’t really know.
I guess if it has the equations for these internally it could trace them with different values to get some coordinates but this is only my theory
Dimitar,
I didn’t have any discussion prior to this thread, it’s just that other discussions about integration with civil exist, but they’re only request to make dynamo Civil3D aware.
Since I know it will not be on any priority list for dynamo developers, I did my research and found the information i posted in the OP.
Another thing I didn’t mention is that not everything you can do with .NET API is exposed in COM, i.e. getting corridor regions (I made the switch from VBA to .NET in order to overcome this in one of my automation projects), so it can be problematic for some of the features I would like to implement!
Anyway, thanks for your input!
Hi Andrea,
I’ve never looked in Civil 3d, but you should definitely check what’s exposed through COM in the documentation and decide if that’s enough to work with. You can access the documentation from civil3d’s built in help browser(F1 > Developer Home Page) or from an older version shared online:
http://docs.autodesk.com/CIV3D/2014/ENU/Developers_Guide/index.html
So, for example all of the exposed civil3d classes would look something like this:
For my needs, I only needed to extract basic acad primitives (like points, lines, plines, etc. ) and that’s already available in great detail as ActiveX:
http://help.autodesk.com/view/ACD/2016/ENU/?guid=GUID-A809CD71-4655-44E2-B674-1FE200B9FE30
As I said, it’s not very fast to execute. A few thousands of entities takes a few seconds, but that’s perfectly fine for my needs. Here’s a quick example of the sort of performance that you can expect:
Your own needs will obviously be different because civil projects tend to be much larger than building projects, but if you can get the data that you need through com interop and if you can limit the data sets to a few thousand objects, I believe that ActiveX can be a viable approach.
2 Likes
Thanks Dimitar for your insights.
I’m already familiar with the Civil3D object model, and I previously coded excel macros to query and create elements, but I moved to .NET because it was painfully slow (and, as I wrote previously, I also found that I cannot export Corridors data with COM but I can do it in .NET).
So for now I’ve set up a civil .NET plugin with various commands to export the information I need on CSV files and then feed them to Dynamo to continue the workflow.
My goal is to save a step and do everything in dynamo (also to open up the possibilities of automation to my colleagues), but since the Dynamo/COM process is slower than the two step workflow, for me it’s not worth it.
Thanks again for your time!
Hi @Dimitar_Venkov1
I’m interested in this.
Excuse my ignorance- but where did the AutoCAD.Read node come from?
Or is this a custom node you created ?
Andrew
Hi Andrew,
It’s a custom node that is not shared at the moment.
1 Like
Hi @Dimitar_Venkov is there a chance to publish AutoCAD.Read node? Thanks.
Note that there is now a direct integration with Dynamo for Civil 3D 2020 which can be found at manage.autodeak.com, or the Civil Connection which can be found on GitHub.