FingerJoints icon indicating copy to clipboard operation
FingerJoints copied to clipboard

Issues with component rotation?

Open ModischFabrications opened this issue 3 years ago • 9 comments

It seems like finger joints in sub-components are calculated without respecting the rotation/movement of sub-assemblies. The screenshot should show everything, feel free to ask for more details if needed.

image

ModischFabrications avatar Aug 29 '21 21:08 ModischFabrications

Hmm, interesting. I tested with rotated bodies and saw no issue, so it has to be related to sub-assemblies. Can you let me know the steps to reproduce this bug?

FlorianPommerening avatar Sep 01 '21 11:09 FlorianPommerening

I created a component, created a body based on a scetch inside of it, then rotated and moved the whole subassembly, then tried to generate the finger joints. My picture shows the difference in origins, do note the rotation.

I think I "captured" the new position of the subcomponent, but I'm not sure. I would need to recreate it in a new project if you are unable to reproduce it based on my previous paragraph.

ModischFabrications avatar Sep 01 '21 18:09 ModischFabrications

OK, so both bodies are inside the same subassembly? Did you rotate the subassembly and create the joint while it was the active component or was the root component active?

I'll try to reproduce this but it might be a while until I get around to it. I only work on this project in my spare time.

FlorianPommerening avatar Sep 02 '21 08:09 FlorianPommerening

I found one possible cause of this is if pieces are moved and their position is not captured before the command executes. The fix is simply to declare the command as "position dependent". This makes Fusion prompt the user for either capturing the position of moved pieces or reset them. There is a good explanation of why this is necessary here: https://www.youtube.com/watch?v=ZlfSFnj46gY

@ModischFabrications, could you check if this solves your issue? The updated code is not merged in the main branch yet, in case there are more cases where the rotation causes an issue. You can find it in branch "issue8": https://github.com/FlorianPommerening/FingerJoints/archive/refs/heads/issue8.zip

FlorianPommerening avatar Sep 25 '21 10:09 FlorianPommerening

Sorry, I don't get to CAD very often. Looks like the issue persists:

image

I drag-and-dropped the plugin into the directory and restarted fusion, so I'm more or less positive that the fix doesn't fix the problem.

There was no prompt for saving the position, it seems like the component was already fixed in position.

ModischFabrications avatar Oct 04 '21 19:10 ModischFabrications

In that case there must be some other way of rotating parts that I'm not aware of. Can you create a minimal working example to demonstrate the bug and list the steps to recreate it? You already did this earlier and wrote

I created a component, created a body based on a sketch inside of it, then rotated and moved the whole subassembly, then tried to generate the finger joints.

If I follow these steps, after rotating and moving the part, I get the prompt for capturing the position. How did you create the second body (inside the component or outside or in its own component, before rotation or after)? How exactly did you do the rotation? Which component was active for which operation?

FlorianPommerening avatar Oct 05 '21 09:10 FlorianPommerening

  1. Create component
  2. Activate component
  3. Model two bodies in subcomponent
  4. Move/Rotate component, capturing position
  5. Apply finger joints -> wrong direction image

ModischFabrications avatar Oct 07 '21 16:10 ModischFabrications

Thanks, that helped me to recreate the issue. I'm not sure yet what a good solution would be but if you want a quick fix, you can try to edit the file FingerJoints.py and replace this

    def createCustomFeature(self, body0, body1, toolBody0, toolBody1):
        app = adsk.core.Application.get()
        activeComponent = app.activeProduct.activeComponent
        # We will later group all created features into a custom feature.
        # For that reason, we have to remember the first and last feature that is part of this group.
        tool0Feature = createBaseFeature(activeComponent, toolBody0, "tool0")
        createCutFeature(activeComponent, body0, tool0Feature)
        tool1Feature = createBaseFeature(activeComponent, toolBody1, "tool1")
        createCutFeature(activeComponent, body1, tool1Feature)

with this

    def createCustomFeature(self, body0, body1, toolBody0, toolBody1):
        app = adsk.core.Application.get()
        activeComponent = app.activeProduct.activeComponent
        rootComponent = app.activeProduct.rootComponent
        # We will later group all created features into a custom feature.
        # For that reason, we have to remember the first and last feature that is part of this group.
        tool0Feature = createBaseFeature(rootComponent, toolBody0, "tool0")
        createCutFeature(activeComponent, body0, tool0Feature)
        tool1Feature = createBaseFeature(rootComponent, toolBody1, "tool1")
        createCutFeature(activeComponent, body1, tool1Feature)

This will create the tool bodies used to cut the fingers in the root component instead of the active component. Not ideal for an organizational aspect but it got rid off the error for me. I want to keep this issue open and look for a better solution where the tool bodies are created in the active component.

FlorianPommerening avatar Oct 11 '21 07:10 FlorianPommerening

For later reference: there are two issues with creating the component inside the active component instead of the root component. I asked about them on the forums.

https://forums.autodesk.com/t5/fusion-360-api-and-scripts/transformation-when-adding-a-brepbody-in-component/td-p/10677775

https://forums.autodesk.com/t5/fusion-360-api-and-scripts/problem-when-adding-a-brepbody-in-the-copy-of-a-component/td-p/10678752

FlorianPommerening avatar Dec 28 '21 08:12 FlorianPommerening