Python Script (Reflected Property)

Hi everyone,

Could someone help me to understand why I’m having this output while trying to simply retrieve the start point of the curve?

Thx

change this:

for curve in curvelist:
    templst.append(Curve.StartPoint)

to this:

for curve in curvelist:
    templst.append(curve.StartPoint)

The way you currently have it, you are trying to get the StartPoint property of the Curve class (from the ProtoGeometry library) rather than that of an instance of a Curve.

4 Likes

Thanks for explanation, @cgartland. This was an easy fix, I guess.

Since everything is case sensitive, I need to pay more attention next time.

BTW, how to retrieve X, Y or Z coord in this case? Do I need to do one more loop? Thx

Assign your start point to a variable and then access its X, Y, and Z properties separately:

for curve in curvelist:
    start_point = curve.StartPoint
    x = start_point.X
    y = start_point.Y
    z = start_point.Z
1 Like

Works fine, but the output is only 1 x value, not the values of the entire list. Where is the trick?

curves = IN[0]

# Place your code below this line
output = []

for curvelist in curves:
	templst = []
	for curve in curvelist:
		start_point = curve.StartPoint
    		x = start_point.X
    		y = start_point.Y
    		z = start_point.Z
  
	templst.append(x)
output.append(templst)
	
# Assign your output to the OUT variable.
OUT = templst

Stupid mistake.


Just moved the templist.append(x) to the right.

Anyways, you saved me some time. Cheers!

No problem. Just a heads up–you will need to indent your output list as well, otherwise it will only contain the last templst.

1 Like