sketch (non XY) movement problem

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!
kisolre
Posts: 2269
Joined: Wed Nov 21, 2018 1:13 pm

Re: sketch (non XY) movement problem

Postby kisolre » Wed Jun 26, 2019 8:37 am

Daniel Cocoliso wrote:
Tue Jun 25, 2019 9:41 pm
Hello...
Why are you using Part Loft to create a loft between sketches in PartDesign Body? PartDesign Additive Loft works just fine. And what is the actual problem? Not able to create solid Loft? Not able to understand LocalCoordinateSystem vs GlobalCoordinateSystem?
PD Loft.JPG
PD Loft.JPG (81.49 KiB) Viewed 444 times
User avatar
bejant
Posts: 6076
Joined: Thu Jul 11, 2013 3:06 pm

Re: sketch (non XY) movement problem

Postby bejant » Wed Jun 26, 2019 1:59 pm

asdaf wrote:
Sat May 04, 2019 11:13 pm
2. I pad that sketch (here is the first problem: why the pad is done in Y- direction?)
As Jim wrote, the Sketch has it's own Local Coordinate System ("LCS"), and so the Sketch is being Padded in the +Z direction of the Sketch.

If you enable the Navigation Cube it might be easier to visualize the orientation of how the Sketch is Mapped. Looking at the Navigation Cube it is easy to see that the Sketch is Mapped onto a Plane that is parallel to the Front face of the Navigation Cube, and it becomes easier to visualize the direction in which the Sketch will Pad. I might also help to select Sketch and click the LCS icon to create one relative to Sketch.

asdaf wrote:
Sat May 04, 2019 11:13 pm
3. I try to change position of pad. To do that I need to change position of sketch. Sketch "Placement" is not accessible, so I use "Attachment", and here it all falls apart. This is what happens when I try to move it 20 mm in Y+. Pad is moved 20mm in Z+, sketch is moved 20mm in Y+, but rotated 90deg in X.

This does not happen when sketch is created on XY. Please help / explain as I simply don't understand it.
There are two issues at play here. One is that the Attachment Offset coordinates reflect the LCS of Sketch and not Global Coordinates. The other issues is that in 0.18 Placement widget of the Attachment Offset [...] button is broken.

We recently had a related topic, and there were some detailed explanations:
https://forum.freecadweb.org/viewtopic. ... 39#p316458

I think this has been fixed in FreeCAD 0.19, so you may want to try it.

asdaf wrote:
Sun May 12, 2019 9:00 pm
I expect the pad to be done in Y+ not Y-
That's because the Sketch is Padded in the +Z direction of the Sketch, not the direction of the Global Coordinate System.

Maybe this helps explain things?
Daniel Cocoliso
Posts: 7
Joined: Tue Jun 25, 2019 2:43 pm

Re: sketch (non XY) movement problem

Postby Daniel Cocoliso » Wed Jun 26, 2019 2:30 pm

Hello.

I'm sorry, but I didn't comment all the necesary in English forum. I said in Spanish forum that the problem isn't to do the Loft, the problem is moving a Sketch on a XZ plane or YZ plane. It happend this way:

.- I create a sketch of a circumference on another plane that is not XY (XZ, for example) and I finish it.
.- I duplicate it in the "Edit" menu.
.- When I'm going to modify its position on the Y axis I can only do it with "Attachment" not with "Placement", the copied circle is rotated alone and placed in the XY plane.
.- Once I finish moving it also the origin circle is turned to the XY plane.

I don't know why it happend. I talk about the Loft procedure to show the circles rotated on the XY plane, but the Loft is created correct on the original XZ plane.

I'm starting on FreeCad, and I'm followin some videos that use the Part Design to make two sketches on XY plane and use Part to make the Loft. That's the reason why I make that way.

Thanks ;-)
jmaustpc
Posts: 10203
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: sketch (non XY) movement problem

Postby jmaustpc » Thu Jun 27, 2019 12:42 am

there is a bug in FreeCAD 0.18 (as Bejant said) that is fixed in 0.19 but I have discovered a different bug in 0.18.1 and still in 0.19 which I think is what you are seeing here.
Daniel Cocoliso wrote:
Wed Jun 26, 2019 2:30 pm
.- When I'm going to modify its position on the Y axis I can only do it with "Attachment" not with "Placement",
firstly I'll answer that as a Help question because it is simply wrong. You don't, in your example, move the sketch by adjusting "placement Offset", you click on the PartDesign "Map Sketch to face" icon and then follow the options, it disconnects the old attachment and allows you to attach to something else. It used to only work on faces, until recently, but now has the axis planes of the Body and lots of other options including the original "faces" of a solid.

Once a sketch or anything else is "attached" to anything (including the axis planes of a Body in PartDesign), like you would find in the real world, its placement is defined by its attachment to that other object and that other object's placement. The system will then calculate the position/placement of that sketch and of course it then must be read only. On top of all that we now have "attachemnet offset" which also can be set so the system also has to add that to the placement calculation.

For example imagine that you have a 10mm default Part WB Cube. Imagine that you attach the sketch to the cube's face such that it is on the face that is parallel to the YZ axis plane but is x=10mm. While the Default Part Cube is at its default placement, one corner sits on global origin. So the system calculates the Placement of the Sketch as Z=0, Y=0, but x=10 (because we attached to the x+10mm face of the cube). Now if you move the Part Cube in the x direction to x=20mm by editing the Cube's placement x value....then the x value of the sketch becomes "Cubes x placement value 20mm" + "width of Cube in x direction, 10mm" which equals 20 + 10 = 30mm. Hence the system adds that x=30mm to the read only placement values of Sketch. If the attached sketch's placement could be directly edited then by definition it is no longer attached (which is what happens for a new sketch by default, in workbenches other than PartDesign).

Now to consider "attachment offset". All it is is exactly as explained above, except that it adds one more feature, you can manually define an "offset" value to an attachment.

So for the above example, what if you want to attach a sketch to that same face but not actually sitting exactly on it, perhaps 15mm off it but still parallel and still move with any change in the placement of that face (if you moved the cube for example, and you want the offset sketch to follow accordingly)? Well then you just attach the sketch to that face .... but add the 15mm offset via the "Attachment Offset" values (which use the local axis system of the sketch being attached and not the axis system of the cube you are attaching to, which probably makes more sense to you if you wanted to be 15mm offset from an angled face of a pyramid for example). So now the system has to calculate placement of the sketch attached to the cube like this "Cubes x placement value 20mm" + "width of Cube in x direction, 10mm" + "Attachment Offset x direction 15mm" which equals 20 + 10 + 15 = 45mm. Of course my example is simplified, because I have deliberately been taking about everything moving the same direction and in global x. Placement is calculated including movement in which direction, in which axis set, it includes the angle in each axis of each axis system.

Now for the bug,.....i will make a new post... my cow has got into the wrong paddock! A very naughty but much loved steer that my kids named Geoffrey. I have to move him back with the rest of the herd....I'll be back in a bit....

Jim

OS: Ubuntu 18.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.1.
Build type: Release
Python version: 3.6.7
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Australia (en_AU)

bug still in 0.19

OS: Ubuntu 18.04.2 LTS (KDE/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Python version: 3.6.8
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Australia (en_AU)
jmaustpc
Posts: 10203
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: sketch (non XY) movement problem

Postby jmaustpc » Thu Jun 27, 2019 1:31 am

Now for the bug.

issue #4039

If in PartDesign you Edit menu...Duplicate an existing sketch (don't duplicate dependencies), then use "map to Face" to attach that duplicate sketch to a different axis plane it will appear to work. However when you enter sketch edit mode by double clicking, then exit edit mode, the duplicated sketch will appear to go back and attach itself to a different axis plane. If you click on re-compute, it returns to its correct new axis plane.

Note that if you just create the sketch on the desired Axis Plane to begin with then you will not see this bug.

Here is a file create in FreeCAD 0.19 from the daily PPA. I did also create another file in the same manner, with similar contents, in 0.18.1 from the FreeCAD Release PPA and it had the same issue.
sketchswitchingplanes019.FCStd
(17.28 KiB) Downloaded 14 times
In the FreeCAD project file above I have created three sketches that contain a rectangle, for clarity the duplicate and third sketches also have other geometry added within their rectangle for easy visual identification.

To replicate
1)I first created "Sketch" on XY plane
2) edit menu ...duplicate "Sketch" to create "Sketch001"
3) Use PartDesign "Map to Face" to move its attachment to XZ plane
4) create a new sketch "Sketch002" on the ZY axis
5)Enter edit mode for sketch001 then exit, it will appear to have moved back to XY plane, (although depending on which sketch I entered first it did sometimes go to ZY plane)
6)click recompute, "sketch001" appears to move back to XZ where it attachment should be.
7) note that on occasions it appear on ZY plane on exiting edit mode, rather than its proper XZ or the original copied "Sketch" attachment XY plane, when it did this a recompute was required twice to move it to its correct attachment plane XZ,
8) After some more testing, it would seem that the system is remembering the attachment plane of the last few sketches that were in edit mode, and with each recompute it cycles back through them all until you get to the correct one. To see this, enter then exit edit mode for "Sketch", then "Sketch002", and then do the same for "Sketch001" (which is the sketch created by "Duplicate"), then after exiting edit mode for Sketch001 notice its apparent change in attachment plane...click on recompute repeatedly and watch "sketch001" apparently cycle through the attachment planes of the other two in the order in which you had entered/exited edit mode for each.
9) I noticed that the Attachment Map Mode property for the first and last sketches that I created on their correct planes is " Flat Face" where as Sketch001 (the duplicated sketch I moved with the "Map to face" tool) says "ObjectYZ" which is what I had selected. That means the YZ of "Body" right? I had selected the appropriate plane from the create new sketch dialogue for the other two on creation so shouldn't they say ObjectXY or XZ?


This first screen shot shows what the three sketches should look like...note that the rectangle containing one small circle is the Sketch001 which is the one that was created by duplication and moves around. It is shown here correctly in the XZ plane.

Screenshot_20190627_094056.png
Screenshot_20190627_094056.png (51.41 KiB) Viewed 411 times

In this next screen shot you can see sketch001 has moved to the same plane (XY) as, and is overlapping, sketch,
Screenshot_20190627_093855.png
Screenshot_20190627_093855.png (54.55 KiB) Viewed 411 times

In this last screen shot you can see sketch001 has moved to the same plane (ZY) as, and is overlapping, sketch002,
Screenshot_20190627_094011.png
Screenshot_20190627_094011.png (45.98 KiB) Viewed 411 times




OS: Ubuntu 18.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.1.
Build type: Release
Python version: 3.6.7
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Australia (en_AU)

bug still in 0.19

OS: Ubuntu 18.04.2 LTS (KDE/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Python version: 3.6.8
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Australia (en_AU)
Top
Daniel Cocoliso
Posts: 7
Joined: Tue Jun 25, 2019 2:43 pm

Re: sketch (non XY) movement problem

Postby Daniel Cocoliso » Thu Jun 27, 2019 4:59 pm

jmaustpc wrote:
Thu Jun 27, 2019 1:31 am
Now for the bug.

issue #4039

If in PartDesign you Edit menu...Duplicate an existing sketch (don't duplicate dependencies), then use "map to Face" to attach that duplicate sketch to a different axis plane it will appear to work. However when you enter sketch edit mode by double clicking, then exit edit mode, the duplicated sketch will appear to go back and attach itself to a different axis plane. If you click on re-compute, it returns to its correct new axis plane.

Note that if you just create the sketch on the desired Axis Plane to begin with then you will not see this bug.

Here is a file create in FreeCAD 0.19 from the daily PPA. I did also create another file in the same manner, with similar contents, in 0.18.1 from the FreeCAD Release PPA and it had the same issue.

sketchswitchingplanes019.FCStd

In the FreeCAD project file above I have created three sketches that contain a rectangle, for clarity the duplicate and third sketches also have other geometry added within their rectangle for easy visual identification.

To replicate
1)I first created "Sketch" on XY plane
2) edit menu ...duplicate "Sketch" to create "Sketch001"
3) Use PartDesign "Map to Face" to move its attachment to XZ plane
4) create a new sketch "Sketch002" on the ZY axis
5)Enter edit mode for sketch001 then exit, it will appear to have moved back to XY plane, (although depending on which sketch I entered first it did sometimes go to ZY plane)
6)click recompute, "sketch001" appears to move back to XZ where it attachment should be.
7) note that on occasions it appear on ZY plane on exiting edit mode, rather than its proper XZ or the original copied "Sketch" attachment XY plane, when it did this a recompute was required twice to move it to its correct attachment plane XZ,
8) After some more testing, it would seem that the system is remembering the attachment plane of the last few sketches that were in edit mode, and with each recompute it cycles back through them all until you get to the correct one. To see this, enter then exit edit mode for "Sketch", then "Sketch002", and then do the same for "Sketch001" (which is the sketch created by "Duplicate"), then after exiting edit mode for Sketch001 notice its apparent change in attachment plane...click on recompute repeatedly and watch "sketch001" apparently cycle through the attachment planes of the other two in the order in which you had entered/exited edit mode for each.
9) I noticed that the Attachment Map Mode property for the first and last sketches that I created on their correct planes is " Flat Face" where as Sketch001 (the duplicated sketch I moved with the "Map to face" tool) says "ObjectYZ" which is what I had selected. That means the YZ of "Body" right? I had selected the appropriate plane from the create new sketch dialogue for the other two on creation so shouldn't they say ObjectXY or XZ?


This first screen shot shows what the three sketches should look like...note that the rectangle containing one small circle is the Sketch001 which is the one that was created by duplication and moves around. It is shown here correctly in the XZ plane.


Screenshot_20190627_094056.png


In this next screen shot you can see sketch001 has moved to the same plane (XY) as, and is overlapping, sketch,
Screenshot_20190627_093855.png


In this last screen shot you can see sketch001 has moved to the same plane (ZY) as, and is overlapping, sketch002,

Screenshot_20190627_094011.png





OS: Ubuntu 18.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.1.
Build type: Release
Python version: 3.6.7
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Australia (en_AU)

bug still in 0.19

OS: Ubuntu 18.04.2 LTS (KDE/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Python version: 3.6.8
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Australia (en_AU)
Top
Right, with your file, every time I recompute the Sketch001, it change form one plane to other, and at the next recompute to the next plane, and so on!

Thanks for all ;-)
kisolre
Posts: 2269
Joined: Wed Nov 21, 2018 1:13 pm

Re: sketch (non XY) movement problem

Postby kisolre » Thu Jun 27, 2019 6:47 pm

jmaustpc wrote:
Thu Jun 27, 2019 1:31 am
Here is a file create in FreeCAD 0.19 from the daily PPA.
Did you check dependency graph and the attachment of Sketch001? It somehow got attached to itself with ObjectYZ appachment. Which causes it to rotate on every recompute.
CyclicDependencyToSelf.JPG
CyclicDependencyToSelf.JPG (120.62 KiB) Viewed 380 times
chrisb
Posts: 27983
Joined: Tue Mar 17, 2015 9:14 am

Re: sketch (non XY) movement problem

Postby chrisb » Thu Jun 27, 2019 7:57 pm

Daniel Cocoliso wrote:
Thu Jun 27, 2019 4:59 pm
jmaustpc wrote:
Thu Jun 27, 2019 1:31 am
(lots and lots of quotation)
(little of answer)
JimDaniel, please quote only the part of a message you are directly referring to. That makes it much easier to understand.
User avatar
bejant
Posts: 6076
Joined: Thu Jul 11, 2013 3:06 pm

Re: sketch (non XY) movement problem

Postby bejant » Thu Jun 27, 2019 10:58 pm

^^ That's for Daniel, not for Jim... ^^
chrisb
Posts: 27983
Joined: Tue Mar 17, 2015 9:14 am

Re: sketch (non XY) movement problem

Postby chrisb » Thu Jun 27, 2019 11:25 pm

Thanks for the clarification. I edited my post to make the references clearer.