Projecting a face on to sketch comes in inverted?

Projecting a face on to sketch comes in inverted?

Anonymous
Not applicable
1,140 Views
4 Replies
Message 1 of 5

Projecting a face on to sketch comes in inverted?

Anonymous
Not applicable

given a BRepFace (target_face in this example which is obtained by walking a BRepEdge) I want to create a sketch on that face with the geometry of the BRepFace projected on to it. 

 

new_sketch = target_face.body.parentComponent.sketches.add(target_face)
new_sketch.project(target_face)

This works for many faces however for reasons I cannot ascertain sometimes it comes in mirrored:

Capture.PNG

 I've tried even creating an  0-offset construction plane and projecting the face on to that with the same results. 

 

 

 

0 Likes
Accepted solutions (1)
1,141 Views
4 Replies
Replies (4)
Message 2 of 5

ekinsb
Alumni
Alumni

Can you export a model that demonstrates this problem to an f3d and attach it here?  Also if you can attach an image clearly showing which face is causing the problem.  That should help us to reproduce it and if we can reproduce it we should be able to fix it.  Thanks.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
0 Likes
Message 3 of 5

Anonymous
Not applicable

I've attached the f3d file with the errant sketch still in place for inspection. The target face is the right most of the right component as highlighted below as well. A potential reason for this might be because that component origin on the timeline comes from a mirror-component operation causing math weirdness on the back end. 

 

Untitled.png

0 Likes
Message 4 of 5

ekinsb
Alumni
Alumni
Accepted solution

Thank you for the model.  I am able to reproduce the problem and will file a bug.  However, in your specific case you may not need the fix.  When you create a new sketch on a face using the Sketches.add method it creates the sketch and automatically projects the face onto the sketch.  These automatically created curves aren't shown but you can see that they are there because you'll see that profiles have been created so it displays in the light yellow.  Also, if you add this to your code immediately after you create the sketch you'll see that it contains 8 lines.  And the automatically created lines are correct.

 

    ui.messageBox('Lines: ' + str(new_sketch.sketchCurves.sketchLines.count))

Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
0 Likes
Message 5 of 5

Anonymous
Not applicable

I typically observe this behavior (both when interacting via the API or as a good old mouse and keyboard using human) when components have been translated - especially when rotated.

0 Likes