Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

jointOrigins

MichaelT_123
Advisor

jointOrigins

MichaelT_123
Advisor
Advisor

Hi,

.... another exception needed   ... from log file ...

-------------------------------------------------------------------------------------------

CodeLine' if( comp.jointOrigins )
Traceback (most recent call last):
if( comp.jointOrigins 😞
File "..../Api/Python/packages\adsk\fusion.py", line 31437, in <lambda>
__getattr__ = lambda self, name: _swig_getattr(self, Component, name)
File "..../Api/Python/packages\adsk\fusion.py", line 57, in _swig_getattr
raise AttributeError(name)
AttributeError: jointOrigins
----------------------------------------------------------------------------------------------
 
As a clarification ,the component in this case does not posses jointOrigin ... and I know F360 team recommendation  ... just use magical "try" and see what happens.
 
Yes it is a solution ... but looking from broader perspective and  finding so many such "field's mines" in API ... the safe code would  require an exception by an exception by an exception ... by  ... lines of code. It is not a good practice at high level programming.
Would not be cleaner to manage it within API itself just by allocating NULL pointers to objects during initialization/construction phases?
 
There might be exceptional exception excuses ... but too many, make them a rule ... so the exception as a name is misleading.
 
With Regards
MichaelT
 
 
 
 
 
 

 

 

MichaelT
0 Likes
Reply
303 Views
1 Reply
Reply (1)

marshaltu
Autodesk
Autodesk

Hello,

 

The trackback just shown attribute "jointOrigins" doesn't exist. The correct one is "jointOrgins". It looked we made typo mistake when we designed the API. We will estimate if we can make a correction in future updates.

 

Regarding to exception pattern in Python language, we did have some criteria when an exception will be thrown and when "None" object will be returned. The "exception" usually means program run into wrong situation. E.g. the example of "jointOrigins". The "None" object means it is legal at the moment. E.g. ModelParameter.createBy (https://forums.autodesk.com/t5/fusion-360-api-and-scripts/possible-bug-in-modelparameter-object-crea...). Ideally we will document the latter one in our API help.

 

Please report issues to us if you find anything to break the criteria.

 

Thanks,

Marshal 



Marshal Tu
Fusion Developer
>
0 Likes