Documentation and stubs not up-to-date

Documentation and stubs not up-to-date

0xHexdec
Contributor Contributor
442 Views
1 Reply
Message 1 of 2

Documentation and stubs not up-to-date

0xHexdec
Contributor
Contributor

Hey all,

I was trying get the control points of a sketchControlPointSpline I created in fusion by hand but as I checked the count property via:

 

 

rootComponent = adsk.fusion.Design.cast(app.activeProduct).rootComponent
my_spline_sketch = rootComponent.sketches.itemByName("Sketch_Name")
print(my_spline_sketch.sketchCurves.sketchControlPointSplines.item(0).controlPoints.count)

 

 

I got greeted by an error:

 

 

AttributeError: 'SketchPointVector' object has no attribute 'count'

 

Funfact: The code above itself is flawed, count is neither a property nor a method to get the length or size of a list in Python. *facepalm* I use too many languages simultaniously... but the following findings hold nevertheless.

 

The python documentation clearly states the type as "an array containing SketchPoint" (SketchControlPointSpline.controlPoints Documentation) but the stub states it as a list[SketchPoint] so the code suggestion from vscode shows all list-related methods (count in particular). The C++ documentation states an array as well but the example shows the use of a vector.

I used type annotations to get the type right, but the type is neither available in the stubs nor described in the documentation, hence this code is marked as an error by vscode:

 

 

points: adsk.fusion.SketchPointVector = spline.controlPoints

 

 

even tough the resulting call works just fine:

 

 

print(points.size())

 

 

wich I got from python itself by checking all the available methods with this line:

 

 

print(dir(controlPoints))

>> OUTPUT
['__bool__', '__class__', '__delattr__', '__delitem__', '__delslice__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getslice__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__module__', '__ne__', '__new__', '__nonzero__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__setslice__', '__sizeof__', '__str__', '__subclasshook__', '__swig_destroy__', '__weakref__', 'append', 'assign', 'back', 'begin', 'capacity', 'clear', 'empty', 'end', 'erase', 'front', 'get_allocator', 'insert', 'iterator', 'pop', 'pop_back', 'push_back', 'rbegin', 'rend', 'reserve', 'resize', 'size', 'swap', 'this', 'thisown']

 

 

 

Firstly I thought it is my fault in some way (old stubs or something) but as the correct Type is not described in the documentation at all and there are some inconsitencies In the documentation aswell, I ask myself: How up-to-date is the documentation and the stubs?

Accepted solutions (1)
443 Views
1 Reply
Reply (1)
Message 2 of 2

kandennti
Mentor
Mentor
Accepted solution

Hi @0xHexdec .

 

As mentioned here, xxxVector is not mentioned in the documentation.

https://forums.autodesk.com/t5/fusion-360-api-and-scripts/tracking-selections-external-to-fusion360/... 


I have not looked into it, but I encounter it quite a bit.
For now, you'll just have to get used to it.

0 Likes