2D Contour with STEP silhouette is incomplete

2D Contour with STEP silhouette is incomplete

billostratum
Advocate Advocate
458 Views
10 Replies
Message 1 of 11

2D Contour with STEP silhouette is incomplete

billostratum
Advocate
Advocate

I am trying to do a 2D Contour on the silhouette of a STEP file. The file has been exported from Rhino.

2023-10-04.png

The Silhouette selections looks pretty good in the Geometry tab, but there are two gaps, resulting in an open chain. When the toolpath hits these gaps it switches from Outside to Inside. I would like to fix this somehow.

 

3D Contour works fine, but 2D has some benefits for my application, one of which is Tabs.

 

I believe I could select the individual chain segments of a closed silhouette, but there are dozens of segments requiring much effort.

 

I have many such parts in Rhino, and many more expected in the future. The parts have complex geometry and there is no appetite for major changes in Rhino.

 

I've tried importing meshes and 2D sketches, but haven't been able to get a silhouette from these formats.

 

I'm also wondering if I can repair this body in Fusion somehow.

 

Any ideas are welcome.

Tia,
Bill

.f3d is attached

billoStratum
0 Likes
Accepted solutions (1)
459 Views
10 Replies
Replies (10)
Message 2 of 11

seth.madore
Community Manager
Community Manager

This is an error in the shape recognition and it's being caused by the splines. We have some internal fixes for this issue, but they won't be out to users for a bit yet.

Manual contour selection is annoying but doable:

2023-10-04_13h33_27.png


Seth Madore
Customer Advocacy Manager - Manufacturing


0 Likes
Message 3 of 11

billostratum
Advocate
Advocate

Thanks for the quick reply. I can get by with 3D contour for now.

billoStratum
0 Likes
Message 4 of 11

seth.madore
Community Manager
Community Manager

Oh, I did share your file back with the needed selections done 🙂


Seth Madore
Customer Advocacy Manager - Manufacturing


0 Likes
Message 5 of 11

billostratum
Advocate
Advocate
I'm new at chain selection. Did you have to click dozens of times, or was there an easy way to select that chain?
billoStratum
0 Likes
Message 6 of 11

programming2C78B
Advisor
Advisor

also consider just sketching on the bottom and doing a projection of the face. You will then get the entire silhouette, and can also add in any overhang sections. 

Please click "Accept Solution" if what I wrote solved your issue!
0 Likes
Message 7 of 11

seth.madore
Community Manager
Community Manager
Accepted solution

@programming2C78B wrote:

also consider just sketching on the bottom and doing a projection of the face. You will then get the entire silhouette, and can also add in any overhang sections. 


Actually, not likely:

2023-10-04_14h48_23.png

Little "insider knowledge": the tool that does the Silhouette contour in the toolpaths is closely linked to the same tool that does a silhouette projection in Sketches


Seth Madore
Customer Advocacy Manager - Manufacturing


0 Likes
Message 8 of 11

billostratum
Advocate
Advocate
I quickly learned about Sketching and was able to produce acceptable Silhouettes. I have some Control Point curves mixed with straight line segments, some of which seem to have redundant points and/or not-quite-coincident points. I used the Silhouette for a 2D Contour, and added "radial stock to leave" to accommodate the inaccuracies in my Sketching. Then a final 3D contour at full depth to finish it off.
billoStratum
0 Likes
Message 9 of 11

billostratum
Advocate
Advocate

I have a large number of parts that have bad silhouettes like this.

 

I was able to script a semi-automated procedure suggested by @programming2C78B to greatly speed up my process.

 

def createProfilesForBodies(comp :fusion.Component):
    body :fusion.BRepBody
    sketch :fusion.Sketch
    entity :fusion.SketchEntity

    bodies = comp.bRepBodies
    sketches = comp.sketches

    # create a sketch for each body and Project the body to the sketch surface to create a Profile, which will require manual fixup
    for body in bodies:
        sketch = sketches.add(comp.xYConstructionPlane)
        sketch.name = f'Profile {body.name}'
        entities = sketch.project(body)
        for entity in entities:
            entity.isReference = False # "Break Link" from the body to enable manual editing
    return

def mergeClosePoints(sketch :fusion.Sketch):
    global _app, _ui

    sketchPoints = sketch.sketchPoints
    pt1 :fusion.SketchPoint
    pt2 :fusion.SketchPoint

    zeroThreshold = .0007 # this is about how close as the vector/move command gets
    closeThreshold = .01 #cm. close enough to move without thinking about which point to move
    gapThreshold = .05 #cm. a gap this size requires manual inspection to see which point of the two to move
    numMoved = 0 # merge very close points by moving one to the other (they may still be zeroThreshold apart after moving)
    numGaps = 0 # report the number of tiny gaps that should be inspected to determine which point to move

    for pt1 in sketchPoints:     # compare each point
        for pt2 in sketchPoints: # to all of the other points
            if pt1 == pt2: continue
            distance = pt1.geometry.distanceTo(pt2.geometry)
            if distance < zeroThreshold: # no movement required, but add a Coincident constraint to aid profile closure
                addConstraint(sketch, pt1, pt2)
            elif distance < closeThreshold: # move points closer together and add a Coincident constraint
                pt1.move(pt1.geometry.vectorTo(pt2.geometry))
                addConstraint(sketch, pt1, pt2)
                numMoved += 1
            elif distance < gapThreshold: # report the number of tiny gaps that need attention
                numGaps += 1
    
    return (sketchPoints.count, numMoved, numGaps//2)

# add a Coincident constraint
def addConstraint(sketch, pt1, pt2):
    try:
        if pt1.geometricConstraints.count == 0 and pt2.geometricConstraints.count == 0:
            sketch.geometricConstraints.addCoincident(pt1, pt2)
    except:
        print(traceback.format_exc()) # fusion may fail with VCS_SKETCH_SOLVING_FAILED, but it appears to be OK
billoStratum
0 Likes
Message 10 of 11

seth.madore
Community Manager
Community Manager

Very cool!

Out of curiosity, could you share the files that have failed to produce contours? I'd love to throw them against some solutions we're working on and make sure these files can calculate properly without the need for a script.

You can email them to me if you prefer: seth DOT madore AT autodesk DOT com


Seth Madore
Customer Advocacy Manager - Manufacturing


0 Likes
Message 11 of 11

billostratum
Advocate
Advocate

There was one file at the top of this topic.  Another one is linked here.

 

Below is an image of the problematic area.

 

billostratum_0-1699022690324.png

 

billoStratum
0 Likes