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: 

How to tell if a component is a parametric design, or not?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Dave.SendItCNC
225 Views, 2 Replies

How to tell if a component is a parametric design, or not?

The following python code works great to dump component names and values, until its used on a design which includes non-parametric components. In that case, fusion.py correctly reports 'RuntimeError: 3: this is not a parametric design" from _fusion.Component__get_modelParameters.
 
So, does anybody know  how to tell if a component is not a parametric design, so as to avoid referencing the modelParameters property?
 
...
for comp in design.allComponents:
    if comp.modelParameters:
        for param in comp.modelParameters:
            logger.print('Component: {} param: {} = {}'.format(comp.name,param.name,param.value))
2 REPLIES 2
Message 2 of 3
BrianEkins
in reply to: Dave.SendItCNC

You can determine this but it's not a property of a component but is a setting of the Design.  The entire design is either parametric or not.  You use the designType property of the Design object.  It can be one of two values: adsk.fusion.DesignTypes.DirectDesignType or adsk.fusion.DesignTypes.ParametricDesignType.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 3 of 3
Dave.SendItCNC
in reply to: BrianEkins

Brian, thanks! Works great now.
 
...
 
 
for comp in design.allComponents:
    if comp.parentDesign.designType == adsk.fusion.DesignTypes.ParametricDesignType:
        for param in comp.modelParameters:
        logger.print('Component: {} param: {} = {}'.format(comp.name,param.name,param.value))
    else:
        logger.print('Component: {} is not a parametric design'.format(comp.name,param.name,param.value))

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