Help with Python - Rookie here!

Hi All,

Just a quick question. I’m quite new in python using the libraries. Don’t know really hot to use the functions. I made this sime code just to get the StartPoint of a curve that I have:

import clr

clr.AddReference('ProtoGeometry')
import Autodesk.DesignScript.Geometry
from Autodesk.DesignScript.Geometry import *


clr.AddReference('DSOffice')
import DSOffice
from DSOffice import *

clr.AddReference('DSCoreNodes')
import DSCore
from DSCore import *

linea = IN[0][0]

OUT = Autodesk.DesignScript.Geometry.Curve.StartPoint(linea)

I’m getting the following error:

image

I’d be very thankful if you could give me some tips, or where can I find the info relating the usage of Design Script nodes in python codes.

Thanks in advance!

wouldn’t Curve.StartPoint node do the job?
image

Yes. This is only an example. I’m trying to learn hot to make some geometry and work with lists inside the python code,

Here is something that could help:

1 Like

Thanks @Yna_Db. I noticed he’s not using directly the ProtoGeometry. He’s using the revit API for the query of the information needed, and at the end, he change the data to Dynamo geometry with ToProtoType(). Am I right?

I have a different situation. I’m working with dynamo geometry and I want to adjust it through some instructions in python (this could be done using OOTB nodes, but I want to learn a bit further).

All that I’m actually doing is in the Dynamo geometry.

Thanks in advance

With the ProtoGeomety already imported, you have access to all the Dynamo Geometry methods.

Take the line and wire it into the “Curve.StartPoint” node, then rightClick and Node2Code. The resulting DS can be copy/pasted pretty much directly as-is into Python (except replace the line variable with “linea”)

2 Likes

Is this what you’re after ?

1 Like

Yes! With this example and what @Ben_Osborne said, I’m getting the picture of how this thing works! Thanks both of you. I’ll give it a try.

Cheers!

1 Like