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: 

Self intersecting sweep on a tight curve - detecting and deleting resulting artifact

1 REPLY 1
Reply
Message 1 of 2
Aaargh74
186 Views, 1 Reply

Self intersecting sweep on a tight curve - detecting and deleting resulting artifact

I have a routine in a script to make a surface sweep along a spline similar to a bevel. 
If the spline has a tight curve the resultant sweep has an artifact on the rear.  This is upsetting subsequent operations in the script.

I'm after suggestions to detect and delete this artifact  

Aaargh74_0-1647568163816.png

Aaargh74_1-1647568215362.png

 

 

1 REPLY 1
Message 2 of 2
kandennti
in reply to: Aaargh74

Hi @Aaargh74 .

 

Interesting subject.

 

At first I thought I could determine self-intersections with the SurfaceEvaluator.getParamAnomaly method, but I could not.

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-d6b7d30a-972b-4117-9292-c0a87be8ba62 

 

The next method I came up with was to use the TemporaryBRepManager.createWireFromCurves method.

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-62A548C4-305D-47D3-9574-A09743736FC8 

 

I created a sample like this.

 Fusion360API Python script

import traceback
import adsk.fusion
import adsk.core

def run(context):
    ui: adsk.core.UserInterface = None
    try:
        app: adsk.core.Application = adsk.core.Application.get()
        ui = app.userInterface

        msg: str = 'Select Face'
        selFilter: str = 'Faces'
        sel: adsk.core.Selection = selectEnt(msg, selFilter)
        if not sel:
            return

        face: adsk.fusion.BRepFace = sel.entity

        if isSelfIntersect(face):
            msg = 'Self intersecting.'
        else:
            msg = 'Not self intersecting.'
        ui.messageBox(msg)


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

def isSelfIntersect(
    face: adsk.fusion.BRepFace) -> bool:

    tempMgr: adsk.fusion.TemporaryBRepManager = adsk.fusion.TemporaryBRepManager.get()
    curves = [e.geometry for e in  face.edges]

    try:
        tempMgr.createWireFromCurves(
            curves,
            False
        )

        return False
    except:
        return True


def selectEnt(
        msg: str,
        filterStr: str) -> adsk.core.Selection:

    try:
        app = adsk.core.Application.get()
        ui = app.userInterface
        sel = ui.selectEntity(msg, filterStr)
        return sel
    except:
        return None

 

I tried it with the attached file and it is able to determine.

1.png

 

However, since self-intersections are determined by the boundaries, it could not be determined for shapes where the boundaries are not self-intersecting.

2.png

 

The only other way I can think of is that self-intersecting surfaces will cause offset surfaces to fail, even if they are only a short distance away. However, I did not know if it is possible to determine that a surface with an offset failure is always self-intersecting.

 

Also, I can't think of any way to remove the unwanted part.

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