API: Setting Stock From Curve

API: Setting Stock From Curve

Anonymous
Not applicable
675 Views
2 Replies
Message 1 of 3

API: Setting Stock From Curve

Anonymous
Not applicable

The FMStock member SetDimmensions() has an optional parameter of StockCurve with type string. My goal is obviously to generate the stock from an existing curve. If this member function is the correct way to go about the issue great, what is this parameter expecting? Ive tried passing it the name of the curve, and implicitly casting string to the Curve variable. If not what is the best way to do this?

 

Thanks

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

spencer.hardcastle
Autodesk
Autodesk
Accepted solution

Hi @Anonymous

 

Thanks for posting!

 

You are correct. Using the method "SetDimensions" is the right way of setting a stock curve. There is a little quirk when setting a stock curve. This is that you need to set the width, length and thickness, even though they aren't used with a stock curve.

 

The code you can use to set a stock curve is as follows;


    Dim doc As FMDocument
    Set doc = Application.ActiveDocument

    Dim stock As FMStock
    Set stock = doc.Stock

    Dim curve As String

    stock.SetDimensions(,2000,2000,30,,,,,"curve2")

 

I hope this helps! If this answers your query, please accept this reply as a solution. If not, please reply to this post.

 


Spencer Hardcastle
Manager of Customer Advocacy - Autodesk Fusion
Message 3 of 3

Anonymous
Not applicable

Ahhh yet another quirk withing the FC API! Your solution pointed me in the right direction. I assume your proposed solution was directed at milling setups, as I found that when creating a turning document, the Length, OD, and ID parameters need to be filled in for the stock curve to work. Thank you!