Syntax problem?

Hello,
I’m trying my hand at python
Is the syntax between dynamo and python nodes different

I get an error message as soon as I remove my # from the 2nd line of the loop

code python:

# Charger les bibliothèques DesignScript et Standard Python
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# Les entrées effectuées dans ce noeud sont stockées sous forme de liste dans les variables IN."
Line=IN[0]
res_length=[]
translate_line=[]
# Placer votre code au-dessous de cette ligne
for i in Line:
    translate_line.append(i.Translate(2,0,0))
    #res_length.append(i.Curve.Length())                  My syntax problem

# Affectez la sortie à la variable OUT.
OUT = translate_line,res_length

cordially
christian.stan

I found, but I’m not sure of ‘‘my analysis’’
Capture d’écran 2023-01-06 211636

for i in Line:
    translate_line.append(i.Translate(2,0,0))
    res_length.append(i.Length)

cordially
christian.stan

Hi,

Translate() is an ‘inheritance’ method (from geometry object)
Length is a ‘get’ property (from curve object)

you can find some info here

https://www.fuget.org/packages/DynamoVisualProgramming.ZeroTouchLibrary/2.13.0.3485/lib/net48/ProtoGeometry.dll/Autodesk.DesignScript.Geometry/Curve

an inheritance graph (for Geometry)

2 Likes

thank you for your time given to improve the skills of the frenchi cannonball

Cordially
christian.stan

3 Likes

off topic ON

I don’t agree with this (you progress well)

off topic OFF

2 Likes