API type error in extrudeFeatures.addSimple

API type error in extrudeFeatures.addSimple

cory.m.isaacson
Participant Participant
533 Views
2 Replies
Message 1 of 3

API type error in extrudeFeatures.addSimple

cory.m.isaacson
Participant
Participant

The `adsk.fusion.FeatureOperations.NewBodyFeatureOperation` is an `int` type and is not recognized in the `extrudeFeatures.addSimple` param for the operation.

 

I got around this and some other type bugs like this:

 

```

new_body_feature_operation: Any = adsk.fusion.FeatureOperations.NewBodyFeatureOperation
extrude_0 = extrude_features_0.addSimple(prof_0, extrude_distance_input_0, new_body_feature_operation)
```
 
The sample code that shows how to work with components does not work because of this error.
 
I know it is tough to get all the types correct, but it does make the API much more usable when they work.
 
Is there a better way that I should have addressed this? It does not appear that there is any cast available.
0 Likes
Accepted solutions (2)
534 Views
2 Replies
  • API
Replies (2)
Message 2 of 3

JeromeBriot
Mentor
Mentor
Accepted solution

I don't think this is a bug.

 

The sample in the API documentation works perfectly with the following line:

extrude1 = extrudes.addSimple(prof, distance, adsk.fusion.FeatureOperations.NewBodyFeatureOperation)

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-CB1A2357-C8CD-474D-921E-992CA3621D04

 

0 Likes
Message 3 of 3

cory.m.isaacson
Participant
Participant
Accepted solution

Thanks Jerome, to clarify the sample runs correctly, it is the typings hints that don’t work. I had to use `Any` or `#type:ignore` to remove the error. But the code itself is functional.

0 Likes