Offsetting sketch to global planes.

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!
freedman
Veteran
Posts: 3436
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: Offsetting sketch to global planes.

Post by freedman »

I was in PartDesign and No I didn't download your file, Oops. I see what your issue is now.

Using Part, I need to add a standard shape so the sketch has something to reference. That seems OK.
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: Offsetting sketch to global planes.

Post by chrisb »

edwilliams16 wrote: Thu Dec 01, 2022 3:16 am When I do that the attachment is ignored - but not zeroed out. Placement isn't updated. Check the coordinates of the center vertex. It shows as origin.
That's what I experience here. Changing the AttachmentOffset does nothing to the sketch.
Only if I create the sketch on the XY_Plane. If I try to offset from the XZ_Plane, I have to do the mental gymnastics of what the compounded placement looks like, since the Placement already has a rotation.
Agreed. Would it be sufficient to make the AttachmentOffset visible and just add it to the Placement? And if so, should that work for non toplevel sketches - or objects in general - be enabled too?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
edwilliams16
Veteran
Posts: 3106
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Offsetting sketch to global planes.

Post by edwilliams16 »

freedman wrote: Thu Dec 01, 2022 7:10 am Using Part, I need to add a standard shape so the sketch has something to reference. That seems OK.
Attaching to a Part Plane Flat-face is a work-around I use.
chrisb wrote:Agreed. Would it be sufficient to make the AttachmentOffset visible and just add it to the Placement? And if so, should that work for non toplevel sketches - or objects in general - be enabled too?
It's only top-level sketches that are annoyingly different to those inside a Part or Body which already have available coordinate systems to attach to.

Perhaps there could be a global Origin object that top-level objects could be attached to? But I don't know what side-effects that might cause.

Alternatively, when top-level objects have an Attachment Placement editable even when their MapMode is deActivated, the Placement should be compounded as you suggest. But this seems not to be backward compatible when you take the Placement out of the direct control of the user, as is done with an active attachment.

Maybe Attachment Placements shouldn't be modifiable when MapMode is deactivated? Doesn't help, but at least reduces confusion.

Maybe there are cleaner solutions...
drmacro
Veteran
Posts: 8862
Joined: Sun Mar 02, 2014 4:35 pm

Re: Offsetting sketch to global planes.

Post by drmacro »

The way I think of it is that the Attachment object (and offsets defined by it) only make sense when there is a container object involved and it is referenced to the global coordinate system.

When there is no container involved the the Placement object defines the location of the object.

And, until there is some other object to attach to, Attachment makes no sense.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: Offsetting sketch to global planes.

Post by chrisb »

drmacro wrote: Thu Dec 01, 2022 11:10 am When there is no container involved the the Placement object defines the location of the object.
I agree, but I also see the reasonable request, e.g. to offset a sketch not lying in XY plane from its plane by just changing its z value. Any ideas? Is it advised then to use a Part container?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
drmacro
Veteran
Posts: 8862
Joined: Sun Mar 02, 2014 4:35 pm

Re: Offsetting sketch to global planes.

Post by drmacro »

chrisb wrote: Thu Dec 01, 2022 11:23 am
drmacro wrote: Thu Dec 01, 2022 11:10 am When there is no container involved the the Placement object defines the location of the object.
I agree, but I also see the reasonable request, e.g. to offset a sketch not lying in XY plane from its plane by just changing its z value. Any ideas? Is it advised then to use a Part container?
Doesn't simply changing the Z value of the Placement value accomplish this? The Root point of the sketch is then offset from the global origin.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Offsetting sketch to global planes.

Post by adrianinsaval »

If you need an origin object just create a Part container and work inside that.
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: Offsetting sketch to global planes.

Post by chrisb »

drmacro wrote: Thu Dec 01, 2022 11:30 am Doesn't simply changing the Z value of the Placement value accomplish this? The Root point of the sketch is then offset from the global origin.
No. On sketch creation you are asked about the main plane. If you select XZ plane, the result is a change of the Placement. An offset in z doesn't move orthogonal to the sketch plane, but rather in global z, which is the sketch's y direction.
While this can be seen as some light brain training, things get really difficult if the sketch is rotated by some other degrees.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
drmacro
Veteran
Posts: 8862
Joined: Sun Mar 02, 2014 4:35 pm

Re: Offsetting sketch to global planes.

Post by drmacro »

chrisb wrote: Thu Dec 01, 2022 12:00 pm
drmacro wrote: Thu Dec 01, 2022 11:30 am Doesn't simply changing the Z value of the Placement value accomplish this? The Root point of the sketch is then offset from the global origin.
No. On sketch creation you are asked about the main plane. If you select XZ plane, the result is a change of the Placement. An offset in z doesn't move orthogonal to the sketch plane, but rather in global z, which is the sketch's y direction.
While this can be seen as some light brain training, things get really difficult if the sketch is rotated by some other degrees.
Ah yes, I was running on no coffee. :oops:
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
edwilliams16
Veteran
Posts: 3106
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Offsetting sketch to global planes.

Post by edwilliams16 »

So using the existing code I see a couple of workarounds to create offset sketches.
  • Drag your current model into an outer Part container and attach your new sketch to its coordinate system.
  • Create a Part 'reference cube', select the face on the desired plane and create your sketch with the default FlatFace attachment.
Either way, you are then free to offset the sketch from your chosen global plane.

In this forum we typically advocate attaching sketches to offset global planes to avoid TNP, but I don't think we explain that in Part workbench this is not as straightforward as it might seem. We also chide people for unnecessarily wrapping their models in Part Containers, when on occasion this might be appropriate even if no assembly operations are anticipated.
Post Reply