How to avoid child geometry damage when resizing parent objects?

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
skarpushin
Posts: 3
Joined: Tue Dec 06, 2016 4:27 pm

How to avoid child geometry damage when resizing parent objects?

Post by skarpushin »

Hi All,

I have an issue I was trying to solve for several days but with no success.
Every time I try to make use of parametric nature of FreeCAD and change dimensions on parent objects my child objects are damaged.
Not always, but very often.

I created simple example to reproduce this issue.
1. Create Sketch1
2. Extrude
3. Create Sketch2 on top face (face1)
4. Use construction geometry to bind to external geometry face1 (see screenshot 1)
5. Change sketch1 dimensions
6. (Error) Sketch2 is now damaged (see screenshot 2)

In addition to screenshots I'm also attaching test FreeCAD project, please find attached.
I don't know if this is a bug or I'm doing something wrong. Hopefully you can help me.

Isn't tangent constraint supposed to keep bottom-right circle on right and bottom lines?

Thank you,
Sergey.

p.s. My FreeCAD info:
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6706 (Git)
Build type: Release
Branch: releases/FreeCAD-0-16
Hash: f86a4e411ff7848dea98d7242f43b7774bee8fa0
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Attachments
sketch invertion issue.FCStd
(6.39 KiB) Downloaded 19 times
screenshot 1.png
screenshot 1.png (35 KiB) Viewed 1562 times
screenshot 2.png
screenshot 2.png (33.73 KiB) Viewed 1562 times
Thank you, Sergey Karpushin.
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: How to avoid child geometry damage when resizing parent objects?

Post by bejant »

skarpushin wrote:I have an issue I was trying to solve for several days but with no success.
Hi Sergey and welcome, next time don't wait so long before asking for help!
skarpushin wrote:Hopefully you can help me.

Isn't tangent constraint supposed to keep bottom-right circle on right and bottom lines?
When a Sketch is shown as being Fully Constrained, that doesn't mean that that is the only way to solve the Constraints in order to make the Sketch become Fully Constrained. Instead, it only means that the Solver has arrived at one possible solution (possibly out of many) that makes the Sketch become Fully Constrained.

There is ambiguity in the way your Sketch is Constrained. In the second screen grab we can see the Tangency Constraints are still fulfilled even though the geometry has changed. Using Arcs instead of Circles, then selecting an endpoint of the arc, then the line segment and applying the Tangency Constraint will afffix the endpoint onto the line segment, eliminating the condition in your second screen grab.

You could also just use Distance Constraints instead and I suspect there are other methods to avoid that problem.

OS: Ubuntu 16.04.1 LTS
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.16.6707 (Git)
Build type: None
Branch: releases/FreeCAD-0-16
Hash: 5465bc47c95db45e0be85dc0e2872419efadce0f
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
20161206c1-sketch invertion issue.FCStd
(9.7 KiB) Downloaded 18 times
20161206d-sketch invertion issue.FCStd
(9.79 KiB) Downloaded 16 times
Edit: Attached a file of each method, and the last file I attached incorrectly had Sketch001 overhanging Pad.
Last edited by bejant on Tue Dec 06, 2016 11:14 pm, edited 1 time in total.
User avatar
Willem
Veteran
Posts: 1852
Joined: Fri Aug 12, 2016 3:27 pm
Location: Lisse, The Netherlands

Re: How to avoid child geometry damage when resizing parent objects?

Post by Willem »

Hi skarpushin, welcome to the forum. This problem that constraining with constructionlines react wrong with dimension changes are common in Freecad. Avoid this type of constraining and work more with dimensions. Here is the changed sketch002 that works well with dimension changes in sketch001
Schermafdruk van 2016-12-07 00-05-19.png
Schermafdruk van 2016-12-07 00-05-19.png (10.64 KiB) Viewed 1538 times
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: How to avoid child geometry damage when resizing parent objects?

Post by NormandC »

Following on Willem's advice, you can give a name to your first 4mm constraint, like "Offset".

For the following dimensions, use the Expressions engine by clicking on the blue f(x) icon next to the dimension input field, then linking to the first constraint by typing

Code: Select all

Sketch.Constraints.Offset
This field supports auto-completion, as soon as you start typing the available choices will be listed.

This way if you want to change the offset value, you only need to change it one time.
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: How to avoid child geometry damage when resizing parent objects?

Post by chrisb »

In this situation it would have been very nice to use the symmetry. Since I have this problem from time to time: is there a possibility to change "point zero" of an attached sketch? Sometimes I would like to change its orientation as well, i.e. the direction of X, Y, Z.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
skarpushin
Posts: 3
Joined: Tue Dec 06, 2016 4:27 pm

Re: How to avoid child geometry damage when resizing parent objects?

Post by skarpushin »

BTW, moving forward does anybody know what part of the code is handling geometry changes? I did a peek on https://github.com/FreeCAD/FreeCAD and haven't find it.
bejant wrote:Using Arcs instead of Circles, then selecting an endpoint of the arc, then the line segment and applying the Tangency Constraint will afffix the endpoint onto the line segment, eliminating the condition in your second screen grab
Thank you for providing example files! I experimented with them a little and distance constraints seem to be doing the job. But to be honest I don't understand why =) Are these constraints holding information about orientation? Because that would be the only explanation why there is only way to solve it.

Example with arcs doesn't work =(. I've changed Constraint11 to 20 and geometry was damaged (see issue3 attached).
Willem wrote:This problem that constraining with constructionlines react wrong with dimension changes are common in Freecad. Avoid this type of constraining and work more with dimensions
Construction lines helps to position elements relatively to others. And this helps to avoid doing a lot of manual math to calculate absolute distance of each element. Is there other way to do relative positioning without construction lines?
Willem wrote:work more with dimensions. Here is the changed sketch002 that works well with dimension changes in sketch001
Isn't it the same approach that was described by bejant shown in "20161206c1-sketch invertion issue.FCStd"?
Do you mind sharing file that is on your screenshot?
NormandC wrote:Following on Willem's advice, you can give a name to your first 4mm constraint, like "Offset".
For the following dimensions, use the Expressions engine by clicking on the blue f(x) icon next to the dimension input field, then linking to the first constraint by typing
I go even further. I've created a spreadsheet and put all parameters to named cells and then use it in expressions for constraints. But I tried to keep the example file as simple as possible so I've removed all unnecessary complications.
Attachments
issue 3.png
issue 3.png (11.77 KiB) Viewed 1485 times
Thank you, Sergey Karpushin.
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: How to avoid child geometry damage when resizing parent objects?

Post by bejant »

skarpushin wrote:Thank you for providing example files! I experimented with them a little and distance constraints seem to be doing the job. But to be honest I don't understand why =) Are these constraints holding information about orientation?
You're welcome. Just change the numerical value of one of the Distance Constraints to a negative number you'll see. That will mess up your model though.
skarpushin wrote:Example with arcs doesn't work =(. I've changed Constraint11 to 20 and geometry was damaged
It looks like you used my file in your screen grab, although I tested it before uploading it (and again after I read your reply), and it worked for me. I can't explain our differing results.
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: How to avoid child geometry damage when resizing parent objects?

Post by NormandC »

chrisb wrote:Since I have this problem from time to time: is there a possibility to change "point zero" of an attached sketch? Sometimes I would like to change its orientation as well, i.e. the direction of X, Y, Z.
Up to 0.16, it is not possible to change the orientation nor the origin of a sketch mapped to a face. It simply locks to the coordinate system of the face and there is no way around it.

Starting with 0.17 (Sergey: 0.17 is still in heavy development and won't be released til sometimes in 2017), there's a new "SuperPlacement" property which overrides the sketch placement and makes what you ask possible.
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: How to avoid child geometry damage when resizing parent objects?

Post by chrisb »

Thank you, I didn't think about the 0.17, but that is again a very usefull new feature. I will try it.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
skarpushin
Posts: 3
Joined: Tue Dec 06, 2016 4:27 pm

Re: How to avoid child geometry damage when resizing parent objects?

Post by skarpushin »

It looks like I'm hitting the same type of issue as before but now I'm not using any construction geometry and have no idea how to avoid this...
Please advise....

How to reproduce:
* Open attached file
* Open Sketch002, check it out -- see how it laid out and how it looks before we make any changes
* Then open "P" node
* Locate "lcdPcbW" variable (row 5, column B)
* Now change formula somehow, i.e. add "+1" so that formula will look like "=80.02 + 1"
* After that go and check Sketch002 -- no errors on it, but it's damaged

So question is: how to prevent this from happening?
Attachments
enclosure2.fcstd
(45.47 KiB) Downloaded 12 times
Thank you, Sergey Karpushin.
Post Reply