References moving after update of dimensions!

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!
Post Reply
KVikLine
Posts: 3
Joined: Tue May 17, 2022 9:47 am

References moving after update of dimensions!

Post by KVikLine »

Hi,
Situation
I’m using FreeCad to create dynamic patterns (tailoring). With current example top + sleeve for children under 8 years.
To realize this work branches (WB) Sketcher & Spreadsheets will be used + combined for.
Dimensions for patterns will be taken from WB-Spreadsheets in WB-Sketcher.
Problem
With changes in WB-Spreadsheets geometry of patterns is adjusted.
Unfortunately, references* also change with dimension update. Finally, model will be destroyed.
*With WB-Sketcher construction lines have dependencies to lines (e.g. EdgeX).
Sleeve contour on the front and back part is the same (have a same length) as the contour on the sleeve in the front and back part.
For better understanding (open WB-Sketcher). Construction line with length 106 mm = round(.Shape.Edge6.Length + .Shape.Edge5.Length + .Shape.Edge4.Length)
Construction line with length 111 mm = round(.Shape.Edge21.Length + .Shape.Edge22.Length + .Shape.Edge23.Length).
With changes in Spreadsheet (replace green and yellow by turquoise by copy + paste) model will be destroyed, because references changed (e.g. length 106 mm is getting another shape Shape.Edge26.Length instead of Edge6….

Solution
An idea how to fix the references for Edges..?
Thank you...
Attachments: DynKinderU8_Alle.FCStd.
PS: I'm using FreeCad 0.19 (RN14555)
Attachments
DynKinderU8_Alle.FCStd
(14.59 KiB) Downloaded 20 times
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: References moving after update of dimensions!

Post by adrianinsaval »

Use named constraints (or at least constraint indexes) instead of direct shape properties, is any of the relevant edges not constrained?
I'm surprised it even let you use those expressions as they can easily become a cyclical dependency @abdullah and/or @realthunder what do you think of this case, shouldn't it be forbidden to use the sketch's shape property for constraint expressions?
User avatar
papyblaise
Veteran
Posts: 7877
Joined: Thu Jun 13, 2019 4:28 pm
Location: France

Re: References moving after update of dimensions!

Post by papyblaise »

If you draw patterns, why did you superimpose the three parts?
I see green lines which should be construction lines: you select them and change them with the sketcher tool, they will become blue again
To fix the geometry it is necessary to fix at least one edge or a line of construction compared to the origin XOY or Z, preferably choosing one of the axes as symmetry

Edit: after modifying the lines in construction lines, I notice that there is also a problem of constraints
Attachments
patron.JPG
patron.JPG (19.43 KiB) Viewed 754 times
User avatar
Shalmeneser
Veteran
Posts: 9475
Joined: Wed Dec 23, 2020 12:04 am
Location: Fr

Re: References moving after update of dimensions!

Post by Shalmeneser »

Main problem :
When modifying a constraint in a sketch (usually a dimension), the sketcher solver looks for a mathematical solution verifying all constraints. BUT when different mathematical solutions exists, the sketcher can provide a mathematically correct solution but not a user correct solution. It's the 'Flip' problem.
So you need to constrain you sketch in order to avoid any flip and this a PITA. Or you can try not to change drastically your dimensions but just step by step to hope the new 'solution' will be the nearest as possible to the last 'solution'

Other problems :
* Your unique sketch is ... unreadable.
* You should separate parts of this sketch in different logical sketches in order to keep it understandable.
* Different sketches can refere to other ones via Sketcher_External.
* You can use Master sketch to set vital reference which will be used later. This sketch do not need to be used for the drawing.
* All sketches can be visible then in the same TechDraw page.
* You need to give name (alias) to the value in the spreadsheet to use reference name instead of cryptic coordinates.
* You should use geometric constraints over dimension when it's possible : a same dimension should be used once then Sketcher_ConstrainEqual. (48 : 5x)
* Fixed angles like 45°, 30°, 60° should be geometry and not dimension.
KVikLine
Posts: 3
Joined: Tue May 17, 2022 9:47 am

Re: References moving after update of dimensions!

Post by KVikLine »

@adrianinsaval thanks for the answer.
I'm a little bit surprised (it's strange) that not all dependencies are present. I haven't had any massages or remarks that anything is missing with drawing.
As far as I know, this (cyclical dependencies) occurs when the dependencies change from table to drawing and from drawing to table. I only use these in one direction - from the spreadsheet to sketcher.
Last edited by KVikLine on Tue May 17, 2022 5:58 pm, edited 1 time in total.
KVikLine
Posts: 3
Joined: Tue May 17, 2022 9:47 am

Re: References moving after update of dimensions!

Post by KVikLine »

@papyblaise, thank you for reply!
If you draw patterns, why did you superimpose the three parts?"
This method will be used with drawing on the paper, this is a reason thy I'm using this with CAD also. But I will try to use separate drawing and implement changes mentioned by @Shalmeneser
Other problems
also - thaks for that!
I'll get to "work", I'll report if something new or totally wrong. :-)
Thank you for your support.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: References moving after update of dimensions!

Post by adrianinsaval »

KVikLine wrote: Tue May 17, 2022 5:32 pm @adrianinsaval thanks for the answer.
I'm a little bit surprised (it's strange) that not all dependencies are present. I haven't had any massages or remarks that anything is missing with drawing.
As far as I know, this (cyclical dependencies) occurs when the dependencies change from table to drawing and from drawing to table. I only use these in one direction - from the spreadsheet to sketcher.
This one is a special case because the object depends on itself, you are using values from the shape property of the sketch in sketch constraints, this is in general a bad idea, when recomputed these values can change and the expressions then need to ve reevaluated which means the sketches requires recomputation again and the values could change again and so on.

Like others have said it's better if you split this sketch in different sketches, you may use sketcher external if necessary but it's also preferable if you can get all you need with expressions and constraints because external geometry is also bound to the topo naming problem.
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: References moving after update of dimensions!

Post by realthunder »

adrianinsaval wrote: Tue May 17, 2022 12:42 pm I'm surprised it even let you use those expressions as they can easily become a cyclical dependency @abdullah and/or @realthunder what do you think of this case, shouldn't it be forbidden to use the sketch's shape property for constraint expressions?
I don't have any general solution to deal with this type of internal property dependency loop. It is up to the objects to check by themselves, which is not that easy to do.

KVikLine wrote: Tue May 17, 2022 11:21 am With changes in WB-Spreadsheets geometry of patterns is adjusted.
Unfortunately, references* also change with dimension update. Finally, model will be destroyed.
If 'Length' is the only thing you need to reference, then as others mentioned, using named Length constraint is the way to go. If the Length is calculated instead of constrained, just make the constraint a reference.
ksnip_20220518-075542.png
ksnip_20220518-075542.png (15 KiB) Viewed 647 times
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: References moving after update of dimensions!

Post by adrianinsaval »

realthunder wrote: Wed May 18, 2022 12:02 am If the Length is calculated instead of constrained, just make the constraint a reference.
Note that within the same sketch this presents the same potential self dependency issue, and it is not directly allowed actually (there is what I consider a bug that let's you workaround this temporarily)
Post Reply