Convert point to point3d

Hi All,
I’m trying to get Start Z and End Z parameters values from a CAD line, then manipulate those Z values and feed them back again to the line parameters, I get stuck in the step of feeding back to the line as obviously those parameters data types are point3D not normal points.

Is there anyway to manipulate point3d, or even convert point to point3d ?

I picked a python code from the forum which converts from Point3D to DS point, and tried to play with it vise versa, but didn’t work.


ConvertPointsToPoints3d.dyn (22.3 KB)

Thanks in advance

HI

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 Autodesk.AutoCAD.Geometry as AG

# Import references from Civil3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *


def ConvertToAGPoint(DSPt):
	pt = AG.Point3d(DSPt.X, DSPt.Y, DSPt.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):
        IN[0] = [IN[0]]

OUT = [ConvertToAGPoint(x) for x in IN[0]]

Thanks so much @hosneyalaa , it seems working.

Just for my knowledge, I can see all what is done is redefining input from (points = [IN[0]] ) to ( IN[0] = [IN[0]] ), I appreciate if you could clarify how does that make that difference ?

Cheers,