Extruding polylines and creating masses from a cad file

Good morning everyone. I have a .dwg file with polylines (they are the silhouettes of buildings). Which dynamo script can I use to extrude them and have masses simultaneously?

Hello @VALENTINA.FEDE,
Which version of Dynamo are you using?

If you have Geometry nodes under Import/Export section of Dynamo library, you can start with those nodes to decide which layers you want to import to Dynamo and then you can create an algorithm to combine the curves and extrude them as solid. These nodes will be helpful for you: PolyCurve.ByJoinedCurves and then Curve.ExtrudeAsSolid

1 Like

OK, thank you very much. I am using the 2019 version of dynamo, but I am not finding the section you are talking about. Maybe I need to search for the package by another name or do that another way?

Time for an update. You’re almost 3 years outside of the support cycle as 2022 is coming to an end shortly…

Hello everyone! I am using Revit 2024 but cannot find this ‘Convert To Geometries’. From the image I expect to find it between file system and image, but it doesn’t seem to be there. Where can I find it? Do I need to download a particular package?

They are only in Dynamo builds from Revit 2025 and up unfortunately. Likely the easy pagg the is to process the dwg data into json format using Dynamo for Civil3D, and then read the JSON in Dynamo for Revit and generate families from there.

I understand, thank you very much!

I’m still trying to extrude them via this script, but it gives me these errors. Any suggestions?


hi
For you to create your solid you need a closed curve or polycurves that describe a closed region
I created a python code but it is not yet finished
(I have a lot of trouble with recurrent functions)
there is the ampersand package that allows you to do it in 2 spoonfuls the sorting of the curves and create the loops


python code to improve…

import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
stock_begin=IN[0]
sb=stock_begin
loop_ext=[sb[0]]
sb.pop(0)

for idx,l in enumerate(sb):
    if (loop_ext[0].StartPoint).DoesIntersect(l.StartPoint) or (loop_ext[0].StartPoint).DoesIntersect(l.EndPoint):
        sb.pop(idx)
        loop_ext.append(l)

ind=1
c=0
while c<=len(stock_begin):
    for idx,l in enumerate(sb):
        if loop_ext[ind].StartPoint.DoesIntersect(l.StartPoint) or loop_ext[ind].StartPoint.DoesIntersect(l.EndPoint) or loop_ext[ind].EndPoint.DoesIntersect(l.StartPoint) or loop_ext[ind].EndPoint.DoesIntersect(l.EndPoint) :
            loop_ext.append(l)
            sb.pop(idx)
            ind+=1
    c+=1

OUT = loop_ext

cordially
christian.stan

1 Like

hi @VALENTINA.FEDE have you tried group your curves…try PolyCurve.ByGroupedCurves and in older version archilab group.curves, and be sure all is closed

1 Like

I tried, but it keeps giving me errors

Thank you! I will also try this

1 Like

I am not sure if I have executed the script correctly. In any case, it does not seem to work


re, my python code must not be at the top surely, I am a beginner
follow more the path of Mr. @Sovitek

cordially
christian.stan

1 Like

One thing I do not understand, for example, is why a trivial circle does not give any problems, as you can see. I suppose it is because it is a closed line. In Revit, in general, how is it possible to make a closed polyline?

you understood
we are trying to group the curves which form a loop
cordially
christian.stan

IT WORKED! Thank you very much!!!

1 Like

…but not for many polylines all at once :frowning:

your geometries can be touching (red point) or another part to be treated later, you should not be discouraged

cordially
christian.stan