FingerJoints
FingerJoints copied to clipboard
Issues with component rotation?
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.
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?
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.
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.
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
Sorry, I don't get to CAD very often. Looks like the issue persists:
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.
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?
- Create component
- Activate component
- Model two bodies in subcomponent
- Move/Rotate component, capturing position
- Apply finger joints -> wrong direction
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.
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