Using cast to further code hints autocompletion

Using cast to further code hints autocompletion

hpekristiansen
Advocate Advocate
647 Views
2 Replies
Message 1 of 3

Using cast to further code hints autocompletion

hpekristiansen
Advocate
Advocate

In  the section "Code Hints" here:

http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-743C88FB-CA3F-44B0-B0B9-FCC378D0D782

 

it can be read, that casting can be used to enable VSC to make code hints. Can someone please explain how and when to use this methode? - I would like as many hints as possible.

 

In this minimal extrusion code:

import adsk.core, adsk.fusion

app = adsk.core.Application.get()
ui = app.userInterface
doc = app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType)
design = app.activeProduct
rootComp = design.rootComponent
extrudes = rootComp.features.extrudeFeatures   
sketch = rootComp.sketches.add(rootComp.xYConstructionPlane)
circles = sketch.sketchCurves.sketchCircles
circle = circles.addByCenterRadius(adsk.core.Point3D.create(0, 0, 0), 5.0)
profile = sketch.profiles.item(0)
extrudes.addSimple(profile, adsk.core.ValueInput.createByReal(5), adsk.fusion.FeatureOperations.NewBodyFeatureOperation)        

.rootComponent

in

rootComp = design.rootComponent

is not hinted. -and it makes no difference, if I use

design = app.activeProduct

or

design = adsk.fusion.Design.cast(app.activeProduct)

What is the advantage of the cast version?

 

Is there a way to make the hints work for everything?

.extrudeFeatures

.sketchCurves

.sketchCircles

...

Right now, it is not working for me.

0 Likes
Accepted solutions (1)
648 Views
2 Replies
Replies (2)
Message 2 of 3

kandennti
Mentor
Mentor
Hi  hpekristiansen.
 
 
Spyder worked well with Intellisense when using casts.
Since becoming VSCode, I feel that "python.autoComplete.extraPaths" in [settings.json] works well.
1.png
 
Also, if you use Type Hint introduced from python3.5, ".sketchCurves" will also work with IntelliSense.
2.png
 
I think other properties and methods will work as well.
Message 3 of 3

Nilesh.Mohite
Autodesk
Autodesk
Accepted solution

Hi @hpekristiansen ,

In addition to @kandennti reply,you can further refere to following post for verifying your settings of python def files(for OSX)

https://forums.autodesk.com/t5/fusion-360-api-and-scripts/code-hints-in-visual-studio-code-howto/m-p...

 

Lets us know if you need further help.


Nilesh Mohite
LinkedIn

If my answer helped you, please use  ACCEPT SOLUTION .
Also be generous with Likes!  Thank you and enjoy!