Face relative sketcher constraints?
Forum rules
and Helpful information
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!
Also, be nice to others! Read the FreeCAD code of conduct!
Face relative sketcher constraints?
I'm probably not using the right search criteria, so I decided to try here.
If I'm applying a sketch to a face in a PartDesign, is there a way to refer to the underlying face for constraints? For example, is there a way to say "as wide as the underlying face" or "a vertical distance from the bottom edge of the face"? If these things are not possible, what is the best practice for setting up sketches relative to an underlying face?
Thanks,
Craig
If I'm applying a sketch to a face in a PartDesign, is there a way to refer to the underlying face for constraints? For example, is there a way to say "as wide as the underlying face" or "a vertical distance from the bottom edge of the face"? If these things are not possible, what is the best practice for setting up sketches relative to an underlying face?
Thanks,
Craig
Re: Face relative sketcher constraints?
Search for "External geometry" and "Shapebinder".
-
- Veteran
- Posts: 5505
- Joined: Thu Apr 05, 2018 1:53 am
Re: Face relative sketcher constraints?
You don't want to attach directly to a face due to the topological naming problem. The Face names are prone to change upon later revisions to your model, in which case the attached sketch tags along with the new name. For example, Face7 might become Face5. It is better to attach to a plane, such as xy plane, and offset with the attachment offset property to position the sketch. If the face is the top face of a Pad, then you can press = key in the z box and enter Pad.Length in the dialog that pops up. This way if you later change the Pad length the sketch will move with the new dimension.
You can also use expressions. For example, if the sketch used to make the first pad is a rectangle, then you could have a named constraint in it called width and maybe another called length. Then when positioning the next sketch you could refer to the contraints as the x,y, or z offset, such as = (popup dialog) Sketch.Constraints.width or maybe width/2 if you've centered the rectangle. Then if you later change that in the sketch the other sketch also moves with it. Name blue reference constraints can also be used in this manner if your sketch is fully constrained and there is no constraint to meet your needs already in it. It would be much simpler if we could just attach to faces, but due to a bug in the system this is not advisable at this time.
If you find a situation where you feel you must attach to a face, then at least try to see if there is a sketch edge to attach to instead. This will be more robust, although not fully robust. At least that way you are protected from changes to other sketches or to the generated geometry.
You can also use expressions. For example, if the sketch used to make the first pad is a rectangle, then you could have a named constraint in it called width and maybe another called length. Then when positioning the next sketch you could refer to the contraints as the x,y, or z offset, such as = (popup dialog) Sketch.Constraints.width or maybe width/2 if you've centered the rectangle. Then if you later change that in the sketch the other sketch also moves with it. Name blue reference constraints can also be used in this manner if your sketch is fully constrained and there is no constraint to meet your needs already in it. It would be much simpler if we could just attach to faces, but due to a bug in the system this is not advisable at this time.
If you find a situation where you feel you must attach to a face, then at least try to see if there is a sketch edge to attach to instead. This will be more robust, although not fully robust. At least that way you are protected from changes to other sketches or to the generated geometry.
Re: Face relative sketcher constraints?
See topological naming problem and how to create stable models for more information on the named issues.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Face relative sketcher constraints?
Thanks for the responses. It does help me better understand the underlying problems. Is there a way to name a line in a sketch that I could then refer to from another sketch? I tried it, but if it is possible I wasn't doing it right. (as in, I couldn't change the name of the line)
-
- Veteran
- Posts: 5505
- Joined: Thu Apr 05, 2018 1:53 am
Re: Face relative sketcher constraints?
The line itself, no, not that I am aware of. You can toggle the constraint type to reference mode (constraints will be blue), give the reference constraint a name, and then reference that name from another sketch. You could, for example, measure the distance of a line from the origin using a reference constraint and then position the offset of your sketch based on that reference constraint. If the sketch is named Sketch002 and the reference constraint's name is line_width, then the reference to it would be:csetera wrote: ↑Thu Oct 28, 2021 9:08 pm Thanks for the responses. It does help me better understand the underlying problems. Is there a way to name a line in a sketch that I could then refer to from another sketch? I tried it, but if it is possible I wasn't doing it right. (as in, I couldn't change the name of the line)
Sketch002.Constraints.line_width
Re: Face relative sketcher constraints?
To add to this: if you check Preferences->Sketcher->Display->Show dimensional constraint namewith format %N=%V you will see the name in 3D view too.TheMarkster wrote: ↑Fri Oct 29, 2021 1:08 am You can toggle the constraint type to reference mode (constraints will be blue), give the reference constraint a name, and then reference that name from another sketch. You could, for example, measure the distance of a line from the origin using a reference constraint and then position the offset of your sketch based on that reference constraint.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
- Shalmeneser
- Veteran
- Posts: 9475
- Joined: Wed Dec 23, 2020 12:04 am
- Location: Fr
Re: Face relative sketcher constraints?
In 0.20 !
Re: Face relative sketcher constraints?
Oh yes, I forgot. Thanks for mentioning.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Face relative sketcher constraints?
Unfortunately, if you create a reference constraint you cannot use that constraint within the same sketch which seems to be an odd behaviour to me. I would expect to be able to use the reference within the same sketch? It would be useful if this issue could be fixed.TheMarkster wrote: ↑Fri Oct 29, 2021 1:08 am The line itself, no, not that I am aware of. You can toggle the constraint type to reference mode (constraints will be blue), give the reference constraint a name, and then reference that name from another sketch. You could, for example, measure the distance of a line from the origin using a reference constraint and then position the offset of your sketch based on that reference constraint. If the sketch is named Sketch002 and the reference constraint's name is line_width, then the reference to it would be:
Sketch002.Constraints.line_width
- Attachments
-
- Screen Shot 2022-05-23 at 8.05.04 AM.png (47.78 KiB) Viewed 1004 times