Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
graham_chow
663 Views, 8 Replies

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

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

Tags (1)
8 REPLIES 8
Message 2 of 9
liujac
in reply to: graham_chow

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
in reply to: graham_chow

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
in reply to: frankzhang

 Hi Frank,

 

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

 

regards,

 

Graham

Message 5 of 9
marshaltu
in reply to: graham_chow

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 360 Developer
Autodesk, Inc.

Message 6 of 9
graham_chow
in reply to: marshaltu

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
in reply to: graham_chow

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
in reply to: MattWynn

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.

Message 9 of 9
ekinsb
in reply to: graham_chow

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report