Autodesk.DesignScript.Geometry has no 'CurveLoop' attribute

I’m a complete beginner who doesn’t know how to program, so I use Gemini to create Python scripts for my needs. The last script I requested from Gemini encountered some issues, and I’m unsure whether it’s a problem with Gemini or with my program’s installation. The script that I was trying to make was a script to divide floors and ceilings with multiple sketches into single ones. But I hit a wall because of this issue.
“The simple test script, targeting a basic point, line, and curve loop, still resulted in the error: Autodesk.DesignScript.Geometry has no ‘CurveLoop’ attribute. This firmly indicates a fundamental issue within the Dynamo/IronPython2 environment.” - Gemini
This was the script provided by Gemini to try to create a CurveLoop on Dynamo:

import clr
clr.AddReference('ProtoGeometry')
import Autodesk.DesignScript.Geometry as DSGeo # Importamos la librería de geometría

# Variable para la salida
test_output = None

try:
    # 1. Intentar crear Puntos de Dynamo
    p1 = DSGeo.Point.ByCoordinates(0,0,0)
    p2 = DSGeo.Point.ByCoordinates(1,0,0)
    p3 = DSGeo.Point.ByCoordinates(1,1,0)
    p4 = DSGeo.Point.ByCoordinates(0,1,0)
    
    # 2. Intentar crear Líneas de Dynamo
    l1 = DSGeo.Line.ByStartPointEndPoint(p1,p2)
    l2 = DSGeo.Line.ByStartPointEndPoint(p2,p3)
    l3 = DSGeo.Line.ByStartPointEndPoint(p3,p4)
    l4 = DSGeo.Line.ByStartPointEndPoint(p4,p1)
    
    curves_list = [l1,l2,l3,l4] # Una lista de líneas de Dynamo
    
    # 3. Intentar crear un CurveLoop de Dynamo (ESTA ES LA PARTE CRÍTICA)
    # Si esta línea falla, el problema es fundamental con DSGeo.CurveLoop
    curve_loop_test = DSGeo.CurveLoop.ByCurves(curves_list) 
    
    test_output = curve_loop_test # Si todo va bien, la salida será el CurveLoop

except Exception as e:
    test_output = "Error en el script de prueba simple: " + str(e)

OUT = test_output

This script gave me this error: ‘Autodesk.DesignScript.Geometry’ object has no attribute ‘CurveLoop’
Because of that, Gemini had to do a workaround using the Revit API instead of Dynamo to develop the final script. I was wondering I anybody can pinpoint the issue of whether this might be an installation Issue, which might seem odd for me since I got the same issue on three computers.

Dynamo converts Revit geometry to Dynamo type (Autodesk.DesignScript.Geometry) seems that your scrip is expecting Revit type of geometry but is receiving Dynamo type

Gemini is the issue.

The training data set for code generation (assuming Gemini’s defaults) doesn’t seem to have a clue what Dynamo can do - instead informing most of what it does by generic data. It’s literally invented a constructor for ‘curveloop’, which exists in Revit and some other kernels, but does not exist in Dynamo. In Dynamo a curve loop is created by the topological faces of geometry objects.

That said, if you were to pass the curve loop back out to Dynamo, there are no nodes which work with them as they are not directly exposed to the user since they have so few uses, and they are not visible in the geometry preview either. As such, it’s likely worth asking, why did you want a curve loop?

Gemini was trying to figure out why “DSGeo.CurveLoop.ByCurves” wasn’t working in the script. This was the message that was sent by Gemini before asking me to run the test script that I shared:
"This error means that when the script attempts to execute DSGeo.CurveLoop.ByCurves(...) (where DSGeo is the alias for Autodesk.DesignScript.Geometry), Python finds the Autodesk.DesignScript.Geometry module but then states that it cannot find the CurveLoop class within that module.

This is very strange for a standard IronPython2 environment in Dynamo because CurveLoop is a fundamental part of Dynamo’s geometry library (ProtoGeometry.dll). It’s as if the geometry library is not loading correctly or is incomplete in your Dynamo session."

Gemini is wrong, like so many LLMs before it.

I would highly suggest you look into doing this task with native nodes, and understanding the methods and how it all works.

Then once at this stage you should be at a good point to understand properly where issues with a python script will be.

Over reliance on AI to do the task for you will not help you fully, and can/does lead people down wrong paths. I have also seen AI give someone a bit of python code that utilised a bad module, luckily it was already removed from certain platforms so the module could not be downloaded.

1 Like

This bit of Python will identify every class which is in the Dynamo Geometry library when accessed as Gemini did:

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript import Geometry as DSGeo
OUT = dir(DSGeo)

Curve loop is not present.

While there is a curve loop class, it’s only accessed via other geometry objects - faces in particular. - and all properties and information about them is read only.

The primary benefit of using geometry for geometry instead of integrations (i.e. the Revit API) is that you don’t have to jump though the hoops of Edge, CoEdge, CurveLoop, and Faces to build a solid (BRep).

1 Like