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!
Hi guys, I’m getting the same error that some posted before, but I don’t know how to fix it. Could you tell me what I can do? Thanks
I tried for curiosity, it crashes Revit closes suddenly
Make sure you are testing with a simple data set as a first step. Also note which version of Revit you are in - version conflict may or may not cause issue(s) over time.
I tried the script, it does the task but the output is not an element with Revit ID, it says
I have some Model Text and wish to extract it’s curves upon the selected toposurface, however, l have had to create copies of the nodes for each letter. Any other solution?
Best to start a new thread, posting your .dyn file and a sample .RVT to go with it as it’s an issue in and of itself.
You can find the Dynamo file and the instructions needed here:
This Dynamo routine generates subregions on a toposurface from a CAD file.
The input to be selected in Revit before running the routine:
- CAD file containing the polylines. It must be already linked to the Revit model;
- Topography on which the subregion/s must be created;
- Model lines (a square, polygon, circle, etc…) that highlights the area* in which the subregions must be created.
Suggestion: start with small areas. It may seem that Dynamo is about to crash…just let it work!
You might be interest in reading an application to a case study: