Issue #6928 - Computed placement wrong when cloning

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
smurfix
Posts: 5
Joined: Thu Dec 12, 2019 11:15 am

Issue #6928 - Computed placement wrong when cloning

Post by smurfix »

Hi,

So I'm in the Parts module. I add a cube and position it based on some formula or other.

Then I go to Parts Design and click Dolly to create a clone, then move the clone around, based on some other formula.

Then I change some variables used in these formulas. Oops, my model is now broken.

The problem is that the clone's original Placement is stored in the copy, using absolute values, not the original formula. Thus, when I change some of the variables which my positioning is based on, the original moves where it's supposed to, but the clone doesn't: its placement is relative to the initial position of the original instead of its current position.

My preferred fix would be for the clone not to have two placements in the first place. It should default to the placement of its parent, using its formulae if applicable, and that's it.

V0.19.

To reproduce:
  • create a variable "off", set it to 1cm
  • create a variable "len", set to 2cm
  • create a cube
  • position the cube with x=off
  • set the cube's x-length to "len"
  • clone the cube
  • position the clone with x="len" so that you now have two consecutive cubes
  • now change "len" and/or change "off"
  • observe that the two cubes no longer align
  • tear out hair
  • either: edit the clone so that its internal "clone###.Placement.Position.x" contains "off" instead of the constant 1
  • or: zero the clone's internal placement entirely and set the body's placement.position.x to "off+len"
  • either way, observe that this construction now works
  • … do the same thing with the umpteen other objects you used to compose your parameterized construction …
I assume that this is a bug and I should go to github and file an issue.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Computed placement wrong when cloning

Post by Kunda1 »

Haven't looked at the details of this post. But I'm curious why it was
1. Not tested on v 0.20dev first?
2. Made into a GitHub ticket without community vetting?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
adrianinsaval
Veteran
Posts: 5534
Joined: Thu Apr 05, 2018 5:15 pm

Re: Computed placement wrong when cloning

Post by adrianinsaval »

What's the gihub issue number?
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Computed placement wrong when cloning

Post by Kunda1 »

adrianinsaval wrote: Sun May 29, 2022 5:37 am What's the gihub issue number?
issue #6928
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Issue #6928 - Computed placement wrong when cloning

Post by Kunda1 »

Updated title to reflect open ticket
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply