Transformation when adding a BRepBody in Component

Transformation when adding a BRepBody in Component

florian.pommereningDGUYA
Enthusiast Enthusiast
890 Views
2 Replies
Message 1 of 3

Transformation when adding a BRepBody in Component

florian.pommereningDGUYA
Enthusiast
Enthusiast

I'm looking for advice on how to deal with a transformation issue that happens when adding a temporary BRepBody to a component that has been moved or rotated. Consider the following scenario:

  1. Create a new component.
  2. Move and rotate the component, then capture the new position.
  3. Create a BRepBody in world coordinates.
  4. Add the created body as a base feature of the component.

The body then uses the world coordinates as local coordinates in the component. If you want to see this in a concrete example, I tried it with the custom pocket add-in: https://help.autodesk.com/cloudhelp/ENU/Fusion-360-API/ExtraFiles/CustomPocketExample.zip Adding a custom pocket to a rotated or moved component shows the problem: the pocket is rotated and shifted too much and can even be outside of the part if the component is shifted too much.

 

I see 2 ways of dealing with this and I'm not sure if one of them is the right way to go.

 

Option A: transform the part to local coordinates. This would look something like this

activeOcc = app.activeProduct.activeOccurrence
if activeOcc:
    t = activeOcc.transform.copy()
    t.invert()
    adsk.fusion.TemporaryBRepManager.get().transform(body, t)

 

Option B: add the base feature in the root component instead of the transformed component. This seems like a logical step because the coordinates of the body are in world coordinates. However in the context of a custom feature (like custom pocket), it seems weird to create the tool body in a different timeline than where it is used and I'm not sure if those features (the base feature adding the tool to the root component and the combine feature using it to cut the custom pocket in the subcomponent) can then be combined in a custom feature. Would that custom feature still be a feature of the component, or a feature of root?

0 Likes
891 Views
2 Replies
Replies (2)
Message 2 of 3

florian.pommereningDGUYA
Enthusiast
Enthusiast

Could this be related to the issues with `transform` on occurrences mentioned here https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-7231EE6E-FB14-4370-AEE5-F9AE7419B97B?

 

0 Likes
Message 3 of 3

tykapl.breuil
Advocate
Advocate

The issue being solved by transform2 is this one : https://forums.autodesk.com/t5/fusion-360-api-and-scripts/strange-behavior-of-occurrence-transform-w...

I'm don't think it is the one you have but I could be wrong.

0 Likes