Sketch changes from hex to square when spreadsheet value is changed

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!
User avatar
db44022
Posts: 9
Joined: Tue Dec 22, 2020 5:59 am

Re: Sketch changes from hex to square when spreadsheet value is changed

Post by db44022 »

drmacro wrote: Sat Jan 28, 2023 7:00 pm
The solver knows nothing about geometry or the users intent or expectations. It finds the first valid solution to the matrix and considers it's job done.

If that happens to have moved things in a way that causes the geometry to be shaped differently from our expectations, it sometimes appears to "flip" things. If a positional constraint were available, then we would be able to constrain "this must be left of that", etc. We can't at this point.
Ahhh... I have seen this in other cases. Especially when working with arcs to make a slot (See the StandardBlockCrossSectionSketch in that same file). It creates a 270degree arc instead of the 90degree I intended! It seemed perfectly happy, but the result was not even close to what I wanted, and I struggled to constrain it and get the shape I needed. I never considered that there could be two solution to the same set of constraints.

I guess defining constraints must be a bit of an art, and I am still doing finger painting!

Thanks, that is a big help.
drmacro
Veteran
Posts: 8983
Joined: Sun Mar 02, 2014 4:35 pm

Re: Sketch changes from hex to square when spreadsheet value is changed

Post by drmacro »

db44022 wrote: Sat Jan 28, 2023 7:13 pm ...
I guess defining constraints must be a bit of an art, and I am still doing finger painting!

Thanks, that is a big help.
Yes, defining a bulletproof constraint scheme is a bit of an art. 8-)

Your welcome.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
Shalmeneser
Veteran
Posts: 9560
Joined: Wed Dec 23, 2020 12:04 am
Location: Fr

Re: Sketch changes from hex to square when spreadsheet value is changed

Post by Shalmeneser »

Usually, when you change dimension lightly, there is no flip.
So a big change can be made by small steps to try to avoid flipping (Ctrl-Z if it occurs).

Modifying an occurrence is an other trip.
chrisb
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketch changes from hex to square when spreadsheet value is changed

Post by chrisb »

db44022 wrote: Sat Jan 28, 2023 7:03 pm Of course I would love any suggestions you have, or point me to somewhere that will help me learn.
1) I would rate the position of the sketch to be poorly chosen: you shouldn't place it arbitrarily, especially not if you can use symmetry.

2) Your sketch is a mess
SnipScreenshot-2ba381.png
SnipScreenshot-2ba381.png (24.41 KiB) Viewed 278 times
too many dimensions, too many elements.

You have 14 dimensions in this sketch, and the question is, do you need them all? This can be tackled in one sketch, but things become much clearer if you make two of them. You will see especially in the second sketch that the fixed 17mm could be omitted. They could have caused problems when you change values in the spredsheet.

Using two sketches, it is easy to see that no dimension can be omitted. You end up with 5 dimensions in the first and 4 in the second.
SnipScreenshot-8ca3a6.png
SnipScreenshot-8ca3a6.png (11.79 KiB) Viewed 278 times
SnipScreenshot-f148cd.png
SnipScreenshot-f148cd.png (14 KiB) Viewed 278 times
(It should be noted that you can have the same reduction if it's all in a single sketch).

3) Attaching HexHoleSketch to the first sketch, makes the DatumPlane redundant, and now you really can control the size of the block in the spreadsheet.

Addendum: I had prepared this before all the answers came, and then forgot, so some remarks are a bit out of context.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketch changes from hex to square when spreadsheet value is changed

Post by chrisb »

And here is the file:
Attachments
Hex Small Bit Unlabeled Rail Block_cb2.FCStd
(58.54 KiB) Downloaded 5 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Shalmeneser
Veteran
Posts: 9560
Joined: Wed Dec 23, 2020 12:04 am
Location: Fr

Re: Sketch changes from hex to square when spreadsheet value is changed

Post by Shalmeneser »

You can translate 45°, 30°, 60° into geometric constraint and no dimension.
I would do the 2nd @chrisb 's sketch into 2 sketches : one for slot and one for rectangle.
Attachments
Capture d’écran 2023-01-29 181958.jpg
Capture d’écran 2023-01-29 181958.jpg (11.01 KiB) Viewed 189 times
Post Reply