What is cast method?

What is cast method?

Anonymous
Not applicable
1,526 Views
2 Replies
Message 1 of 3

What is cast method?

Anonymous
Not applicable

I'm now creating Fusion360 API code with some samples but I can't undertstand the cast method.

 

from this video, it looks like good method to debugging, but I still not understand how to use it

https://www.youtube.com/watch?v=cFrm6N29i9Y&list=PLNMdG2-zY2yEhb_Fl9pJ1SQYGwIDbz7cK&index=7

 

Please let me know where can i see good document.

 

cast method means like below

design = adsk.fusion.Design.cast(product)

 

Accepted solutions (1)
1,527 Views
2 Replies
Replies (2)
Message 2 of 3

goyals
Autodesk
Autodesk
Accepted solution

cast is used to change the type from base type to derived type. A document can contains different type of products like Design, CAM etc. Specific product type like Design is derived from Base type i.e Product. Now When you query document for a product, it returns you Base type and then you need to cast it in to specific type using cast method so that you can call methods available for specific type. If you just need to call methods of base type then there is no need to cast.  

 

Another example just for clarity purpose. If you look at AngleExtentDefinition object here http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-fb59e3fc-efc8-4c98-ab27-8beb31df5a07, it is derived from ExtentDefinition object. If you got ExtentDefinition object and you are interested to call methods on AngleExtentDefinition object then you need to cast it to AngleExtentDefinition like this

 

angleExtentDefinition = ask.fusion.AngleExtentDefinition.cast(definition)

 

I hope it helps.



Shyam Goyal
Sr. Software Dev. Manager
Message 3 of 3

Anonymous
Not applicable

Thank you for your reply.

 

Now I can understand what cast method is more than before.

 

And I found some document which mentions some about this topic, so leave here.

(It was so hard to find for me, because couldn't find with google search with any key word.

I just read all of document...)

 

http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-A92A4B10-3781-4925-94C6-47DA85A4F65A

 

Customizing Fusion 360 Using its Programming Interface - cloudfront.nethttps://d1ozhi4p59900.cloudfr...

 

0 Likes