TechDraw Workbench: Adding two Sketches at once are centered/misplaced

Discussions about the development of the TechDraw workbench
User avatar
bgoodr
Posts: 227
Joined: Sat Jun 14, 2014 9:40 pm

TechDraw Workbench: Adding two Sketches at once are centered/misplaced

Postby bgoodr » Wed Oct 23, 2019 5:46 pm

I believe I have found a bug (or something I am misunderstanding), as described below, when selecting two Sketch objects, and placing them into a TechDraw Page. The objects are not aligned to the coordinate system that is used when I view those sketches in the model view, but seemingly look like they are "centered" (meaning for my purposes, are misplaced).

This is driven by https://forum.freecadweb.org/viewtopic. ... 03#p342703 which is where I first discovered this, but seemingly has little to do with the SheetMetal Workbench, as this can be reproduced by just creating two sketches and placing them into the TechDraw View, as described below.

FreeCAD Daily version:

Code: Select all

OS: Ubuntu 19.04 (ubuntu:GNOME/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Python version: 3.7.3
Qt version: 5.12.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)
In the instructions below, I believe that the use of imperial units is irrelevant: You can use any unit system, just have the width and height be the same (squares) in the two Sketch objects below, but have the two squares be of different sizes so that you can see the issue.

Create a new FreeCAD document.
Create a Sketch, and rename it Sketch1.
In Sketch1, create a rectangle 3in by 3in and constrain the lower left corner to the origin.
Repeat the above and create a new Sketch, rename it Sketch2, but this time have the rectangle be 4in by 4in.


After double-click opening Sketch1, the sketch looks like this:

Image

After double-click opening Sketch2, the sketch looks like this:

Image

Escape out of the Sketch view to be back into the model view.

After selecting Sketch1 the model view looks like this:

Image

After selecting Sketch2 the model view looks like this:

Image

In the model view, select Sketch1, then hold the Shift key down, and select Sketch2. You should see something like this:

Image

Select the TechDraw workbench via:

Image

Download the attached template, USLetter_Landscape_blank.svg, and store it into /usr/share/freecad-daily/Mod/TechDraw/Templates/USLetter_Landscape_blank.svg

Insert a new page using the attached template, using this button:

Image

Click on the "Insert a View of a Draft Workbench object" button:

Image

See the placements are seemingly "centered":

Image

That is not my intent/desire: I want the two Sketches to share the same coordinate system: Instead, it should look pretty much exactly like what I saw earlier in the model view.

If I go into TechDraw page, and manually move the "DraftView" object down and to the left, this is what I would like to see (but asking the user to do that manual move is not the workflow I'm looking for, as eventually this needs to be a part of a SheetMetal unfolding and printing workflow as indicated in the driving forum post above, where the two sketches from the two layers are printed out and aligned according to the original coordinate system):

Image

Granted, if there are use-cases whereby the user actually does want centering behavior, then that should be somewhere in the workflow that is obvious and not hardcoded for centering, giving users a chance to select centering or respecting the originating coordinate system.

Find attached two_sketches_added_to_techdata_page.fcstd please ignore the "techdata" word in file name, it should be
"TechDraw") shows the end result of the above workflow.

So, is there a way for me to avoid that automatic centering behavior such that it respects the originating coordinate system used by both sketches?

Or is this a bug? If it is a bug, then I'll file a bug linked to this forum posting.

Thanks,
-bg
Attachments
two_sketches_added_to_techdata_page.fcstd
(9.32 KiB) Downloaded 13 times
USLetter_Landscape_blank.svg
(1.94 KiB) Downloaded 11 times
Last edited by bgoodr on Thu Oct 24, 2019 1:17 am, edited 1 time in total.
vocx
Posts: 3344
Joined: Thu Oct 18, 2018 9:18 pm

Re: TechData Workbench: Adding two Sketches at once are centered/misplaced

Postby vocx » Wed Oct 23, 2019 8:54 pm

bgoodr wrote:
Wed Oct 23, 2019 5:46 pm
...TechData Page.
...
If I go into TechData page, and manually move the "DraftView" ...
First of all, it's the TechDraw Workbench, not "TechData". Write it many times until you get it right.

Second, you are using TechDraw NewDraft on an object that is not from the Draft Workbench; this is wrong. TechDraw NewDraft is meant to be used with Draft objects only, particularly with things created with Draft Shape2DView, or Arch SectionPlane.

To view the Sketch, use TechDraw NewView, just like with any other solid object.
Always add the important information to your posts if you need help.
To support the documentation effort, and code development, your donation is appreciated: paypal.
chrisb
Posts: 22534
Joined: Tue Mar 17, 2015 9:14 am

Re: TechData Workbench: Adding two Sketches at once are centered/misplaced

Postby chrisb » Wed Oct 23, 2019 10:13 pm

Moved to TechDraw forum. You can edit the first post and edit the subject.
User avatar
wandererfan
Posts: 3674
Joined: Tue Nov 06, 2012 5:42 pm

Re: TechData Workbench: Adding two Sketches at once are centered/misplaced

Postby wandererfan » Wed Oct 23, 2019 11:30 pm

bgoodr wrote:
Wed Oct 23, 2019 5:46 pm
I believe I have found a bug (or something I am misunderstanding), as described below, when selecting two Sketch objects, and placing them into a TechData Page. The objects are not aligned to the coordinate system that is used when I view those sketches in the model view, but seemingly look like they are "centered" (meaning for my purposes, are misplaced).
<<snip>>
Or is this a bug? If it is a bug, then I'll file a bug linked to this forum posting.
Not a bug.

The paper coordinate system has no fixed relationship to the model's coordinate system.

If you want 2 (or more) objects to be drawn in the same relative position as they have in the 3D model, they should be included in the same view.
two_sketches.png
two_sketches.png (67.73 KiB) Viewed 603 times
(I've just noticed a regression where selecting multiple objects within a Body or Group has been disallowed. That will be corrected shortly. )

Is there a reason you're using DraftView to show PartDesign::Sketches? Typically, I would use NewView for sketches. I don't believe DraftView supports multiple source objects. That might be a good feature request if you need to use DrawView for some reason.
User avatar
wandererfan
Posts: 3674
Joined: Tue Nov 06, 2012 5:42 pm

Re: TechData Workbench: Adding two Sketches at once are centered/misplaced

Postby wandererfan » Wed Oct 23, 2019 11:32 pm

PS: even though it is not a bug this time, that's a terrific bug description!
User avatar
wandererfan
Posts: 3674
Joined: Tue Nov 06, 2012 5:42 pm

Re: TechData Workbench: Adding two Sketches at once are centered/misplaced

Postby wandererfan » Thu Oct 24, 2019 12:03 am

Multiple source selection for NewView is working again git commit efd55884ad.
User avatar
bgoodr
Posts: 227
Joined: Sat Jun 14, 2014 9:40 pm

Re: TechData Workbench: Adding two Sketches at once are centered/misplaced

Postby bgoodr » Thu Oct 24, 2019 1:24 am

chrisb wrote:
Wed Oct 23, 2019 10:13 pm
Moved to TechDraw forum. You can edit the first post and edit the subject.
Thank you. I have applied the edits.

It is quite silly actually. The word "techdata" comes from my habitual use of the word at my place of work. My apologies.
User avatar
bgoodr
Posts: 227
Joined: Sat Jun 14, 2014 9:40 pm

Re: TechData Workbench: Adding two Sketches at once are centered/misplaced

Postby bgoodr » Thu Oct 24, 2019 4:47 am

wandererfan wrote:
Wed Oct 23, 2019 11:30 pm
Is there a reason you're using DraftView to show PartDesign::Sketches? ...
The reason is simply that I did not know that the tool required me to use different buttons with different source objects.
wandererfan wrote:
Wed Oct 23, 2019 11:30 pm
... Typically, I would use NewView for sketches. ...
Fair enough. But I didn't know that it mattered. And so now that I know, I will try to be more careful.

Certainly it does matter, but I'm still puzzled as to why a distinction needed to be made.
wandererfan wrote:
Wed Oct 23, 2019 11:30 pm
... I don't believe DraftView supports multiple source objects. ...
It did allow me to select two different sketch objects and didn't complain when I added it to the TechDraw Page.
wandererfan wrote:
Wed Oct 23, 2019 11:30 pm
... That might be a good feature request if you need to use DrawView for some reason.
I'm not sure that I understand what's going on in enough to make such a feature request, at this point in time at least.

Anyhow, I will play with the other method of adding items to View based upon the feedback here and see if I can make sense of it.
User avatar
wandererfan
Posts: 3674
Joined: Tue Nov 06, 2012 5:42 pm

Re: TechData Workbench: Adding two Sketches at once are centered/misplaced

Postby wandererfan » Thu Oct 24, 2019 1:48 pm

bgoodr wrote:
Thu Oct 24, 2019 4:47 am
Certainly it does matter, but I'm still puzzled as to why a distinction needed to be made.
History, mostly. The Drawing wb had an "Insert DraftView into the current drawing" function. Also Draft objects are (were?) 2D.
It did allow me to select two different sketch objects and didn't complain when I added it to the TechDraw Page.
Lack of clarity on my part - you can create multiple sources for DraftView, but it creates 1 View per source object. NewView puts all selected objects in a single View.
Anyhow, I will play with the other method of adding items to View based upon the feedback here and see if I can make sense of it.
Shout if you run into difficulty. :)
User avatar
bgoodr
Posts: 227
Joined: Sat Jun 14, 2014 9:40 pm

Re: TechDraw Workbench: Adding two Sketches at once are centered/misplaced

Postby bgoodr » Fri Oct 25, 2019 3:50 pm

Version is as follows (doing this because of the bug I reported in https://forum.freecadweb.org/viewtopic. ... 66#p343161 ):

Image

I selected both Sketch objects, and used the "Insert View in Page" button, and got this:

Image

Ok, that is probably a "works as designed" result. However, that is not what I'm intending to happen. What I need instead is for both of those view's to be rendered "flat on the paper" inside TechDraw, and not drawn as if the viewers "camera eye" is off in the distance (perspective view).

Sure, I can move the "camera" back in the 3D model to fake it, but no I don't trust the resulting polygons that would be layed on to the TechDraw View to be accurate w.r.t. the units used in the 3D model, because I am reasoning that there is some mapping transformation matrix being used behind the scenes that I don't know how to mess with, nor do I desire to have to fiddle with that low-level of detail for my use-case here). To put this in mathematical terms, I wish there to be a linear relationship between a 3D unit of inches and a TechDraw View unit of inches (e.g. here that happens to be a 1:1 relationship).

Now if you were to tell me to view it from "Top" and do a few more steps to guarantee that 1:1 mapping from 3D space to TechDraw View space, I'd of course be amenable to that. Is that what I'm missing now?

BTW, thanks for your help here!