I am trying to put together a Dynamo graph that takes polylines from AutoCAD, tranfers them to Revit/Dynamo and then via Dynamo lofts them to a desired height.
I actually managed to do this a while back but it only worked with simple shapes and when importing the real (then very sloppy CAD file) crashed so incredibly hard that it broke my file and froze my PC altogehter. For the life of me I can’t remember how I did it since it was so long ago and also due to the severity of the crash I don’t think it was that good of an attempt.
Any help would be appreciated!
attaching a sample DWG file and what I have so far in Dynamo (literally nothing)
Thank you in advance!
Drawing1.dwg (35.8 KB)
try the following and let me know if it was helpful
1.Clean up purge Cad(needless to say)
2. Turn off create model curves,I dont think you will need all curves in revit as model lines.
3.Patch the curves into surface.(Note it easy if you are importing closed polylines from cadd) use Surface.ByPatch node
4.once you have the surface you can loft them with Surface.Thicken node,you can created a random number with in a range and feed it to thickness if you want a random height as is ideally done in master planning.
If you have existing buildings in your DWG you could try downloading an OSM file and make objects from that with Dynamo.
The suggested method works but the problem I encountered is that when there’s more than one polyline (building) dynamo takes all curves and bundles them up in a single list, thus resullting in many errors. I’m trying to figure out how to sort through them.
Thanks for the suggestion!
I will definitely try this, although I fear that it won’t work very well for my region. Will update when I try it.
Thanks for the suggestion!
Today it was suggested to me that I use the curves to create floors in Revit. It worked for the most part, aside from the problem that when there is more than one polyline (building), the way dynamo sorts the curves prevents the script from working as they all get bundled up in a single list.
Does anyone know how to sort the curves and split them?
Great work, there is an Archi-lab Superjoin node in Chinamo you could try?
It would be fantastic to get that flux functionality back… in the uk we have LIDAR surveys of cities so you can get heights too…
Edit: Does this still work?! https://www.google.co.uk/amp/s/dynamonodes.com/2016/04/26/workflow-building-masses-from-osm-files/amp/
Hope that helps,
So here’s my attempts…
One of the nodes in Marcel’s link required some kind of sign-up to google with credit card details… it wasn’t a route i wanted to go down, so I got lat/long coords from a different website and plugged them in. No big deal.
I’m importing to a family environment, this keeps the nasty cad metadata away from my project file, it is very fast and if I partially explode, it’s very easy to push and pull the import. Creating the buildings from lofted curves worked out the most robust, I got issues extruding patched surfaces.
The only stuff I’m really missing is roads, not sure why!
Here’s a different route using QGIS (free) if you have LIDAR it’s a bit more involved but would get you accurate heights from GIS data…
Hope that’s interesting…
A bit of an update on my part that ofc comes with a bunch of new questions.
This looks good, but I do have a cad file with all the information like building footprint, height, streets, etc. Therefore my aim is to use it, as it is the most accurate.
I had a bit of success with the proposed method, however I do get some errors due to overlapping polylines that I don’t know how to fix.
It was suggested by a lecturer who happened to have done a similar script in the past that the buildings can be some type of generic mass or in-place models (don’t quite remember tbh) in order to have the desired height (his actually read some exploded text representing the number of storeys, but creating them eludes me.
Moreover I can really use some recommendations as to how I can optimize the script for a large number of objects. I am uploading a fraction of my cad buildings (roughly around 1/10th of them) so you can get a feel for the amount. As I am writing this it came to me that I can change the scale from meters to something smaller to lighten the load. Will update on that account.
halp.dwg (172.6 KB)
Thank you all for the help!
Hi @h.hristov31 I’m just peeking into this thread, but the gist I’ve got is:
- You are attempting to convert a CAD ImportInstance into Dynamo curves
- You want to group curves together which represent a ‘thing’, e.g. a building
- You want to join these curves then simply extrude them to create a 3D model from your 2D CAD file in Revit
If that is the case, then you can do some simple pre-processing of your CAD file, then take advantage of the natural sorting (or ‘grouping’ so-to-speak) of the curves
CurvesFromCADLayers already does. Basically you need to run a LISP routine in Autocad (dont ask me about this as I dont use Autocad) which places the ‘things’ onto their own layer. Next, bring this file into Revit and simply input it into the
CurvesFromCADLayers node and as it sorts curves by layer automatically, you will immediately have all your required curve groups.
There was a video of a very similar workflow which adopted this approach for CAD room boundaries which later are converted to Revit slabs on the Autodesk Knowledge Network:
Thank you for the suggestion! I will try the LISP routine in the morning even though I have this sneaking suspicion that it will cause my pc to combust hahaha. Will update you tomorrow!
That sort of thing would be quickest for computation:
But you’ll have problems with the buildings that are not closed loops like that one:
In that case even Group Curves won’t help since it will group all of those lines in a single group.
So I got this result with your file:
I suggest that you think about how to make the rest as closed loops
Hey @h.hristov31 ,
As I am writing this it came to me that I can change the scale from meters to something smaller to lighten the load.
The units won’t help, it’s the amount of geometry that’s the issue, not the size. The files are big, but pretty clean. I think in reality some trimming in Autocad is going to work out fastest, it’s just a couple of trim’s in a few of the buildings, as opposed to trying to rebuild stuff in Revit.
The info from GIS or OSM seems better, they are explicitly defining building footprints. if you could extract that, it might be the fastest of all.
@viktor_kuzev’s method for getting the lines is great, it’s really fast!
in order to have the desired height (his actually read some exploded text representing the number of storeys, but creating them eludes me.
If you do have some height information in AutoCAD I would think we can get it out.
Hope that’s of interest,
I decided to use a not so sophisticated method of achieving that, inspired by this the video @Thomas_Mahon suggested, namely to separate the overlapping polylines into other layers.
However I found an issue with the created shapes. No matter what category the shapes are, I can not seem to host them on a toposurface. Although what i need is for each one to move up or down on the Z axis so it can intersect the toposurface and maybe dip a bit so it’s a bit more convincing. None of the revit features that any category posesses are in any of the shapes.
Is there a way to translate each shape up or down in order for it to intersect with the selected toposurface?
the errors are some null values that are autocad polylines that I have missed.
32.dyn (342.5 KB)
I don’t think you can properly host them, but you can maybe use a raybounce then move them up that distance, a bit like this thread?
A randomise node could improve the naturalism of the heights.
Hope that helps,
If you can get the toposurface as a solid, there is the command ProjectInputOnto that might work. Haven’t worked with it yet but it might be worth a shot.
Similarly there is Project command if you use the base curves and the toposurface as a surface.
Avoid PullOntoSurface as it uses the surface normal as the direction, which in a slanted surface will give you incorrect XY positions.
There is a also a surface version, unfortunately it failed for me, possibly because it’s a polysurface?
I tried with a solid with the same result…
Project by point worked though
There’s a springs topography node which crashed my dynamo, the battlebim one works though…I also dropped in the randomise…
ProjectCADToTopo.dyn (841.6 KB)
Hope that’s useful,
When runnig the script I get a bunch of empty lists starting at the Point.Project node.
trying to troobleshoot atm
once the base layer of the script is complete (creating the shapes and hosting them on the topo) I will start looking for a way for the shapes to read the storey number thats inside each polyline as a text note in autocad and elevating to the correct height.
The empty list issue is present with any projection node I use
Hmm… there’s nothing coming out of your Point Project, maybe it’s struggling with your topo?
My topo had just 4 points, 2 @ 1m and 2 @ 50m (I can’t get the file to upload it’s too big).
Perhaps test it with that? Or could you upload your Topo?
Restarted Dynamo and revit;
Created a new topo;
It no longer returns an empty list, however it does some weird thing where I have 205 solids and translates only 104.
Moreover they don’t appear to move in different directions depending on the position of the topo, rather in the same Z direction.
Translation only in a positive Z direction
Translation only in a positive Z direction
RVT + DWG files
When importing dwg set LAYERS to VISIBLE
restarted again and the same issues are present, I think the first one with the empty lists was a fluke and this is it’s final error form