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: 

SectionAnalysis ... Saga continues

0 REPLIES 0
Reply
Message 1 of 1
MichaelT_123
81 Views, 0 Replies

SectionAnalysis ... Saga continues

Hi TF360,

 

As a prolog and the main 'SectionAnalysis Saga' start with some commented python code.

#####################################################

# Take the copy of sectionAnalysisObj.transform
secTransform   = sectionAnalysisObj.transform.copy()                # Stage 0
# Set secTransform.setCell(cell 0,3, 0.1) - representing x-translation to e.g. 0.1
returnValue = secTransform.setCell(0, 3,      0.1 )
# Apply secTransform to sectionAnalysisObj
sectionAnalysisObj.transform = secTransform                         # Stage A
# What you get in sectionAnalysisObj.transform... well one would expect secTransform
# and YES the result is as expected
# Repeat (# Apply secTransform to sectionAnalysisObj)
sectionAnalysisObj.transform = secTransform                         # Stage B
# What you get in sectionAnalysisObj.transform... well, one would expect secTransform
# and NO the result is NOT as expected            
# Repeat (# Apply secTransform to sectionAnalysisObj) - THIRD TIME LUCKY ???
sectionAnalysisObj.transform = secTransform                         # Stage C
# What you get in sectionAnalysisObj.transform... well one would expect secTransform
# and NO WAY ... the result is STILL NOT RIGHT !!!
#
# What is going on there ???
# The seemingly simple equality transfer -  sectionAnalysisObj.transform = secTransform
# hides some additional matrix operations ...
# WHICH IS NOT REFLECTED IN THE CODE SYNTAX NOR DISCLOSED IN THE DOCS -  
# ... transform - "This property allows you to get and set the transformation matrix."
# It is also by the common mathematical standard ILLEGAL !!!
# Even worse ... it undermines the meaning and the value of EQUALITY !!!
# as after sectionAnalysisObj.transform = secTransform  ... sectionAnalysisObj.transform != secTransform
# RESULTS
# (Stage 0, sectionAnalysisObj.transform) = (1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 2.4492935982947064e-16, 0.0, 0.0, -2.4492935982947064e-16, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0)
# (Stage A, sectionAnalysisObj.transform) = (1.0, 0.0, 0.0, 0.1, 0.0, 1.0, 4.898587196589413e-16, 0.0, 0.0, -4.898587196589413e-16, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0)
# (Stage B, sectionAnalysisObj.transform) = (1.0, 0.0, 0.0, 0.2, 0.0, 1.0, 7.347880794884119e-16, 0.0, 0.0, -7.347880794884119e-16, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0)
# (Stage C, sectionAnalysisObj.transform) = (1.0, 0.0, 0.0, 0.3, 0.0, 1.0, 9.797174393178826e-16, 0.0, 0.0, -9.797174393178826e-16, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0)
# As evident sectionAnalysisObj.transform = secTransform is in reality something like sectionAnalysisObj.transform.transformBy(secTransform)
# On this occasion it is impossible not to note popped numbers with low exponents. Normally it is the indication of a poor/sloppy numerical procedure.
# In this particular situation we are dealing with translations/additions  0.0+0.1+0.1+...
# Thus the above results not only don't look good ... but they are INACURRATE !!!
# The below procedure can restore some order ...
def pullToZerosOrOnes( inArray, atol=1e-15 😞
    zeroArray = [0.0 if np.isclose(x, 0.0, atol=atol) else x for x in inArray  ]
    oneArray  = [1.0 if np.isclose(x, 1.0, atol=atol) else x for x in zeroArray]
    return oneArray      
# RESULTS ... in the nicer form
# (Stage 0, sectionAnalysisObj.transform) = (1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0)
# (Stage A, sectionAnalysisObj.transform) = (1.0, 0.0, 0.0, 0.1, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0)
# (Stage B, sectionAnalysisObj.transform) = (1.0, 0.0, 0.0, 0.2, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0)
# (Stage C, sectionAnalysisObj.transform) = (1.0, 0.0, 0.0, 0.3, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0)             
#####################################################  
 
Epilog:
I really do not know what to write here ... after spending two days of trying to find the problem, hence the one simple question.
Are we living in the same universe, or some different virtual realities?
 
Regards
MichaelT
 
       

 

MichaelT
0 REPLIES 0

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report