Ok, I will try to fix them. Thank you very much!
- Disable all geometry preview up unitl the first node with a warning.
- expand the data preview of all nodes connected to the first node with a warning, and the first node with a warning.
- Export the canvas as an image after zooming in with the data previews expanded
- Copy the warning to your clipboard (use graph node manager, available in the extension tab to do this)
- post the preview geometry, the exported canvas, and warning
My guess is your have 3 curves meeting at one point, which is a no-no. Likely the DWG doensât have this, so moving back into a ârun a prep method to extract the data in the native DWG format so polycurve data is not lostâ is the easy way forward.
Hi,
for info, Revit import Cad curves as PolyLine
, we can get them directly
import clr
import sys
import System
# Add references
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
# Add references to 'RevitNodes' and 'RevitServices' for Revit-specific functionality
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
def purge_points(coords_xyz):
out_pts = []
for c_xyz in coords_xyz:
if all(p.DistanceTo(c_xyz) > 0.001 for p in out_pts):
out_pts.append(c_xyz)
return out_pts
def get_Curves_from_CAD(importinstance, lst_layerName=[]):
datas = []
opt = Options()
# get the geometry of the import instance
geoSet = importinstance.get_Geometry(opt)
for geo in geoSet:
if isinstance(geo, GeometryInstance):
for g in geo.GetInstanceGeometry():
if isinstance(g, DB.PolyLine):
# get the graphics style and name of the current polyline
gStyle = doc.GetElement(g.GraphicsStyleId)
gstyleName = gStyle.GraphicsStyleCategory.Name
# check if the layer name is in the specified list
if gstyleName in lst_layerName:
purge_coordinates = purge_points(g.GetCoordinates())
# create a DesignScript polycurve from the polyline
ds_polycurve = DS.PolyCurve.ByPoints([p.ToPoint() for p in purge_coordinates], True)
datas.append(ds_polycurve)
return datas
importinstance = UnwrapElement(IN[0])
lst_layerName = IN[1]
OUT = get_Curves_from_CAD(importinstance, lst_layerName)
Good morning! I have tried again with this script, after adjusting the geometry. It works, but it seems that you have to repeat it for every single polygon (in this case I tried 3). Is there a way to select them all at the same time?
I solved it. I had not noticed an error in the script. Thanks again to everyone!
I have another matter to resolve. Why is it that once the script is executed, when I close dynamo, the objects created disappear?
hi,
you have to use DynamoPlayer
cordially
christian.stan
For now, I donât know how to do as previously said, recurrence and python are too complicated for my current skills
cordially
christian.stan