Improving C++ add in performance (creation of bodies, sketches etc)

Improving C++ add in performance (creation of bodies, sketches etc)

graham_chow
Contributor Contributor
1,136 Views
8 Replies
Message 1 of 9

Improving C++ add in performance (creation of bodies, sketches etc)

graham_chow
Contributor
Contributor

Hi fellow developers,

 

I'm creating an add in for fusion 360 and because it is creating many bodies, it is really slow. Does anyone have any suggestions on how I might improve performance? I created a short video to demonstrate (90 seconds)...

 

 

regards,

 

Graham Chow

0 Likes
Accepted solutions (1)
1,137 Views
8 Replies
Replies (8)
Message 2 of 9

liujac
Alumni
Alumni

Hi Graham,

 

You may have a try on property Sketch.isComputeDeferred which is used to increase the performance as sketch geometry is created.

 

Jack

Message 3 of 9

frankzhang
Alumni
Alumni
Accepted solution

Hi Graham,

 

You can also have a try with history capture turned off, you can do it in Preferences settings. 

 

General -> Design -> Design History -> Do not capture Design History

 

Thanks,

Frank

Message 4 of 9

graham_chow
Contributor
Contributor

 Hi Frank,

 

Not keeping history makes a huge difference! problem solved (I guess) I was already doing the isComputeDefered.

 

regards,

 

Graham

0 Likes
Message 5 of 9

marshaltu
Autodesk
Autodesk

Hello Graham,

 

We are glad you worked the issue around. It would be great if you can send us the addin which you were seeing performance issue in paramatric design. We would like to check what's bottleneck in the kind of design.

 

Thanks,

Marshal



Marshal Tu
Fusion Developer
>
0 Likes
Message 6 of 9

graham_chow
Contributor
Contributor

It is all good now. Subjectively if you turn the history off, I get a 50 fold increase in performance.

 

Just as an asside, I think you developers are doing a great job. Believe me, I know how it is.

 

This is an application of the add in...

 

Printed1.jpg

 

 

Message 7 of 9

MattWynn
Alumni
Alumni

I'm using this to turn off design history for the model I create, then set it back to what it was before:

 

 

// get the current default design type
DefaultDesignTypeOptions currentDefaultDesignType = DefaultDesignTypeOptions::ParametricDesignTypeOption;
Ptr<ProductPreferencesCollection> prdPrefs;
Ptr<FusionProductPreferences> fpp;
Ptr<Preferences> prefs = fusionApp->preferences();
if (prefs)
{
prdPrefs = prefs->productPreferences();
}

if (prdPrefs)
{
Ptr<ProductPreferences> designPrefs = prdPrefs->itemByName("Design");
fpp = designPrefs;
if (fpp)
{
currentDefaultDesignType = fpp->defaultDesignType();
}

// now set to direct modeling so we DO NOT CAPTURE DESIGN HISTORY
fpp->defaultDesignType(DefaultDesignTypeOptions::DirectDesignTypeOption);
// TESTING set to parametric modeling to see if things act different
//fpp->defaultDesignType(DefaultDesignTypeOptions::ParametricDesignTypeOption);
}

// create a new document
m_pNewDoc = fusionApp->documents()->add( DocumentTypes::FusionDesignDocumentType, true, NULL );

// set it back to what it was before
fpp->defaultDesignType(currentDefaultDesignType);


Matt Wynn
Senior Manager, Software Development, Fusion Fabrication
Message 8 of 9

graham_chow
Contributor
Contributor

Hi Matt, I tried this out, but it did not seem to work in the same document.

 

I don't think it is a huge issue since you can always run the addin in a separate document and copy it over.

0 Likes
Message 9 of 9

ekinsb
Alumni
Alumni

You don't have to use the preference and create a new document to change if the design history will be captured.  You can use the designType property of the Design object.  Just be aware that setting this to DirectDesignType will remove any existing history in the model and setting it back to ParametricDesignType will not restore that history.

 

An alternative that lets you combine parametric and direct modeling is to leave the document in parametric mode so design history is captured but create a "Base Feature" where you can create direct modeling features.  This capability is available in Fusion today, but not through the API.  However it is coming in the update scheduled for May.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog