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: 

[CRASH] - component.flatPattern.bendLinesBody on component with no bends

6 REPLIES 6
Reply
Message 1 of 7
gvisca44
399 Views, 6 Replies

[CRASH] - component.flatPattern.bendLinesBody on component with no bends

Was in the process of writing add-in that processes sheet metal components.

 

Found that component.flatPattern.bendLinesBody and component.flatPattern.extentLinesBody against a component with no bends causes crash.  Seems like component.flatPattern.bodies also causes a crash.

 

Crash report 336849264 sent.

 

Glenn.

6 REPLIES 6
Message 2 of 7
BrianEkins
in reply to: gvisca44

A crash is never good, and even when you do something wrong, the API should fail and never crash. However, I created a very simple test case where I made a new design that contained a sheet metal part, inserted it into a new design, and then used the API to call the bendLinesBody property. I'm not seeing a crash, and it returns the body, so there must be something else that's causing it to crash. Can you post a test case and the code that reproduces the crash?

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

Will do @BrianEkins.

 

Just to be clear - because I mis-interpreted the symptoms initially.

 

The crash appears on sheet metal components that dont have bends (where initially I thought it was on linked components).  Just happened that my original tests included linked components that didnt have bends.

 

 

Message 4 of 7
gvisca44
in reply to: gvisca44

@BrianEkins 

 

As requested.  The embedded image (which I have also included as attachment just in case) shows the progression of the script to the point of crash.

 

 

 

import adsk.core 
import adsk.fusion 
import traceback

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        
        product = app.activeProduct
        design = adsk.fusion.Design.cast(product)
        if not design:
            ui.messageBox('No active Fusion design', 'No Design')
            return

        allComps: adsk.fusion.Components = design.allComponents

        for component in allComps:
            for body in component.bRepBodies:
                if body.isSheetMetal:
                    msg = f'Component \t "{component.name}" has sheet metal body'
                    app.log(msg)
                    adsk.doEvents()

                    bendLinesBody = component.flatPattern.bendLinesBody

                    for BRepEdge in bendLinesBody.edges:

                        (retval, isBendUp, bendAngle) = component.flatPattern.getBendInfo(BRepEdge)
                        msg = f'\tretval:{retval} isBendUp:{isBendUp} bendAngle:{bendAngle}' 
                        app.log(msg)
                        adsk.doEvents()

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

 

 

 

 

picture1.png

 

Message 5 of 7
john.kirchner
in reply to: gvisca44

Thank you for providing the f3z + image, I was able to reproduce this and identify the issue. Will get this fixed!



Message 6 of 7
gvisca44
in reply to: john.kirchner

Thanks John.

Is there somewhere I can track the fix ? Or will I receive notification ?
Message 7 of 7
john.kirchner
in reply to: gvisca44

Unfortunately we don't have any public facing bug fix tracking, this specific fix should be out within the next month or so though.

In the meantime one workaround I can suggest is to compare the flatPattern.flatBody.faces.count (shouldn't crash) to the component.bRepBodies[0].faces.count - the counts are equal, then that means there are no bends in the flatpattern.



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