I am unable to convert the Point3d object to Dynamo point. I could make it work with workarounds like creating string from the values and slice it, but I’m looking for a more convinient way. Any ideas?
Thanks in advance.
code in the script found on the Forum:
import sys
import clr
clr.AddReference('ProtoGeometry')
import Autodesk
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS
# Add Assemblies for AutoCAD and Civil3D
clr.AddReference('AcMgd')
clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')
# Import references from AutoCAD
from Autodesk.AutoCAD.Runtime import *
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.EditorInput import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *
# Import references from Civil3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *
def ConvertToDSPoint(cadPt):
pt = DS.Point.ByCoordinates(cadPt.X, cadPt.Y, cadPt.Z)
return pt
# The inputs to this node will be stored as a list in the IN variables
lstCadPoint = IN[0]
OUT = [ConvertToDSPoint(x) for x in IN[0]]
import sys
import clr
clr.AddReference('ProtoGeometry')
import Autodesk
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS
# Add Assemblies for AutoCAD and Civil3D
clr.AddReference('AcMgd')
clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')
# Import references from AutoCAD
from Autodesk.AutoCAD.Runtime import *
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.EditorInput import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *
# Import references from Civil3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *
def ConvertToDSPoint(cadPt):
pt = DS.Point.ByCoordinates(cadPt.X, cadPt.Y, cadPt.Z)
return pt
# The inputs to this node will be stored as a list in the IN variables
#lstCadPoint = IN[0]
if not isinstance(IN[0], list):
profileViews = [IN[0]]
OUT = [ConvertToDSPoint(x) for x in profileViews]
#OUT = [ConvertToDSPoint(x) for x in IN[0]]
I don’t have enough experience
I asked for the code to try it
I tried on one item and it worked
I understand I should IN[0] list
So add a condition
if not isinstance(IN[0], list): profileViews = [IN[0]]
import Autodesk.DesignScript.Geometry as DS
def ConvertToDSPoint(cadPt):
pt = DS.Point.ByCoordinates(cadPt.X, cadPt.Y, cadPt.Z)
return pt
OUT = [ConvertToDSPoint(x) for x in IN[0]]
Cool. Any ideas why it isn’t workiong for me? In Python it says Point has no ByCoordinates attribute.
If done in CodeBlock it returns Null. Civil3D 2022.1