createFaceFromPlanarWires() confused by tangent loops

createFaceFromPlanarWires() confused by tangent loops

GRSnyder
Collaborator Collaborator
457 Views
3 Replies
Message 1 of 4

createFaceFromPlanarWires() confused by tangent loops

GRSnyder
Collaborator
Collaborator

This is really a follow-up to this thread, but the subject has morphed into something a bit different.

 

Is there any standard guidance on creating surfaces of the following type using TemporaryBRepManager.createFaceFromPlanarWires?

 

Screen Shot 2020-12-21 at 5.24.34 PM.png

 

The issue is the circle that is tangent to the outer edge. In the curve set, there is in fact a vertex connected to 4 edges. Just to be clear, the result I would like is something like this:

 

Screen Shot 2020-12-21 at 5.56.13 PM.png

 

It doesn't matter to me if the circle is represented as an interior loop or as an incursion on the outer profile. However, Fusion 360 doesn't like either of these options as input. If the circle is a separate loop, Fusion 360 complains that the wires "intersect or touch". If the circle is included as a detour from the outer contour (in either direction), the complaint is that the "cover failed to make a surface". ("No, you," I want to retort. "You failed to make a surface." 🙂)

 

There is an allowSelfIntersections option to TemporaryBRepManager.createWireFromCurves, but it doesn't seem to make any difference. The errors are the same with or without that.

 

Oddly, the Patch command seems to have no trouble creating this type of surface from a sketch profile. Strange, because it seems the only thing backing up a profile in the API is a set of curve loops, exactly the input I'm already supplying.

0 Likes
458 Views
3 Replies
Replies (3)
Message 2 of 4

kandennti
Mentor
Mentor

Hi @GRSnyder .

 

I hadn't made any assumptions about tangents.
The only other way I can think of is to create a patch with TextCommands.

#Fusion360API Python script
import adsk.core, adsk.fusion, adsk.cam, traceback

_app = adsk.core.Application.cast(None)
_ui = adsk.core.UserInterface.cast(None)

def run(context):
    try:
        global _app, _ui
        _app = adsk.core.Application.get()
        _ui = _app.userInterface
        des :adsk.fusion.Design = _app.activeProduct
        root :adsk.fusion.Component = des.rootComponent

        # get sketch
        skt :adsk.fusion.Sketch = root.sketches[0]

        # get selections
        sels :adsk.core.Selections = _ui.activeSelections

        # Loop through all profiles
        for targetProfile in skt.profiles:
            # select profile
            sels.clear()
            sels.add(targetProfile)

            # execute TextCommand
            _app.executeTextCommand(u'Commands.Start FusionSurfacePatchCommand')
            _app.executeTextCommand(u'NuCommands.CommitCmd')

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


Even in other 3D CAD systems, I don't think it is desirable to have the boundaries of a surface look like the first image.
(It might cause problems.)

0 Likes
Message 3 of 4

BrianEkins
Mentor
Mentor

Here's my guess at what's happening.  The createWireFromCurves is a simple method that takes in an array of curves with not specific requirements of how the curves exist in the array.  It's doing to work to determine how they're connected and building the B-Rep topology for that.  Where you have multiple curves connecting at a single point, it is ambiguous how the curves should connect.

 

I didn't try it but I think you might be able to use the BRepBodyDefinition function in the API where you explicitly define the full B-Rep data to create a body.  Using this you provide a complete definition of the loop that bounds the face and any interior loops.

 

Here's a sample from the online help that demonstrates its use.  It's not simple to use but it is quite powerful.

http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-ca29fec6-6d94-49bb-b4cd-de77c782011a

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 4 of 4

GRSnyder
Collaborator
Collaborator

Thank you both for the comments. I will investigate both of these approaches.

 

As for the suggestion that forms like this should be banned from CAD, I quite agree! And yet, there it is... 🙂 

0 Likes