Hi Jacob, this is my very first post here!
I am trying to acomplish what is being discussed here - create subregions from polylines in a CAD file. The aim is to have a subregion in my topography for each plot of a land in an urban development project.
The thing is: all of the polylines touch themselves, since they share limits with each other - it would be impossible for them not no touch, since that’s what they are supposed to do.
In AutoCAD they are separate entities (closed polylines), but when they are linked to Revit they simply become branching curves and loose their ‘independence’ and I can’t find a way to bring them as separate sublists in Dynamo/Revit.
The only way I see to make this work would be to have each polyline come on a separate layer from AutoCAD, but there are hundreds of them, so unless there’s a way to automate layer creation and assignment to those polylines in AutoCAD, I’m out of ideas…
Would you have any insight on how to solve this problem?
Hi Jacob, this is my very first post here!
- Move each polyline to a block via automation routine fairly easily
- Move each polyline into a new block via automation routine
- Access the polyline geometry via ActiveX or other direct interop on a ‘instance by instance my basis instead of using Revit’s conversion
- Serialize the data from each Polyline into the DYN file you’ll use to generate the Revit objects via Dynamo For Civil 3D and the Data.Remember node which comes with Generative Design, and then write the Revit data as the second step
- Write the polyline data to an intermediate file such a SAT or other format, and read that into the Dynamo for Revit environment
I would stand back from the CPU and say It have data in format X, I need it directly in Y, so I can manipulate it and write new data to Z.
X = DWG polycurves
Y = DYN or other
Z = RVT subregions
If you try to go X > Za > Y > Z you are losing data. Find a way to circumvent the Za and you’ll be fine.
Thank you for your prompt reply!
I see what you mean by skipping Za,but I guess for the options you mentioned, I would need to be familiar with automation in AutoCAD, which I’m not… Also, I didn’t understand the ActiveX option (I’m still what you could call a noob).
I did however manage to find a LISP to export all the XYZ coordinates of all polylines from AutoCAD and get them into a CSV, and from there to Excel.
My doubt now would be, how to format a XLS or CSV with sublists information for Dynamo. What I have now, is an excel sheet with each point described in a line, with a column for X, Y and Z, and it skips a line to separate points from one polyline to the other.
I would really appreciate if I could get a step-by-step of any of these option you mentioned above.
I’m just strating with Dynamo and don’t know any LISP, so I realy can’t find a way to automate block creation to assign each polyline to a different block (I envy you for thinking that’s fairly easy…).
The best I have managed to do, as I mentioned above, was to get all the polyline’s coordinates from AUtoCAD to a csv file, but then I’m losing data again, since some of these polyline segments are arcs instead of straight lines…
Any help here would be appreciated!
In Dynamo for Civil 3D there is a node "Object.SetLayer which will take a list of objects (your polylines as an example) and a list of strings which can be created via this bit of design script:
"subregion #" + (1..List.Count(polylines);
No lisp required, but you do need to start an alternative Dynamo flavor.
Ok, I gotta say I feel pretty dumb, sending files for other people to solve and all. In the end I did solve the problem - my error was not with polylines which would be turned into subregions, but with how I selected the Topography itself.
For other people struggling with this routine: the best way I found (among those described by Jacob) was to convert the polylines to Regions in AutoCAD. Revit/Dynamo interprets AutoCAD’s Regions as Surfaces. You can export just the Regions you want as an .SAT file, import it with Dynamo, and then use Topology.Edges and after that Edge.CurveGeometry to get the Curves pertaining to each original Polyline-turned-Region in the .SAT file. They will come in a neatly organized list with sublists for each Polyline. This way, Dynamo doesn’t get lost with the branching curves.
The problem I ran into, and about which I sent the previous ‘ranting’ post, was that I was getting the target Topography using Category(Topography) → All Elements of Category, and had a list with the sole Topography in my model. This doesn’t work - with this Python script you need to actually use Select Model Element and manually select the Topography because it doesn’t want a list. That made it work!