Starting a sketch, how about select plane in 3D space

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Starting a sketch, how about select plane in 3D space

Post by NormandC »

Long-winded post alert... Sorry, couldn't manage to make it shorter!

TheMarkster wrote: Sun Oct 14, 2018 5:53 am Then each time the user creates a new sketch in Part Design the view will switch to that camera orientation.
I'm sorry but while your current proposal has merit, I find it too narrowly focused. It adds a level of view control complexity for a single workbench. Furthermore, it's a temporary switching of the view for the only purpose of making a Body's planes visible in the 3D view while you select the plane on which to attach the sketch.

Please forget what's been discussed about PartDesign for a moment. IMO and as I've already tried to state and obviously failed, what's being discussed here should not be a PartDesign-specific temporary view setting, it should be expanded to a general setting of the document's initial default view orientation.

The real basic issue here is the following: when a document is first created, the view orientation is set to top, as if the program was only 2D-based.

But FreeCAD proposes multiple modelling methodologies. For example, let's create a new document, switch to the Part workbench and create a cube primitive. For a beginner, what now appears in the 3D view looks like a light grey square, because the view is set to top. Why is that? Wouldn't everybody want to see that cube in 3D? I know I do. When I work in the Part wb, the first thing I always do is switch the view to axonometric. Or it's the next thing after creating a Part primitive.

On the other hand, if I use the Arch workbench, it's logical to start from the top (XY) view because I will first want to create a floor plan using Draft lines and polylines; just like in Sketcher mode, in this case I want the view vector to be normal to the working plane, which in architecture, starts usually on the XY plane.

So in reality, the desirable initial view orientation / camera position depends on what workbench and what tools you are using, but also on user preference.

Arch, Draft, Sketcher - the existing setting of XY view is probably desirable for most users.
Part, PartDesign - for them it is not.

From there, I see two possible approaches:
  1. A general setting to define the initial view orientation of a newly created document.
  2. Workbench-specific settings to define the initial view orientation of a newly created document. Each workbench would have its own setting.
I think that option 2 would add needless complexity to the GUI and to the code base. Option 1 is simpler as a general solution; your "sketch creation view" menu could be changed to an "initial view orientation" menu, located in Display preferences. It would control the initial view orientation for a new document.

Set the initial view to axonometric (currently specifically isometric, but trimetric and dimetric views could be added), and freedman gets exactly what he asked for: the Body's origin planes would be all clearly visible in the 3D view and available for selection.

But in addition to what a single PartDesign user asked for here, it would serve a much broader base of users, who would be free to choose the initial view according to their preference and to their work flow, independent of the workbench they most use.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Starting a sketch, how about select plane in 3D space

Post by NormandC »

TheMarkster wrote: Sun Oct 14, 2018 5:53 am Do you like those settings? If not, experiment with the numbers until you find a configuration you like. I can setup a preference to select Axonometric, Top, Rear, Bottom, Left, Right, or Axonometric2 (open to suggestions for a better name)
Axonometric is a type of orthographic projection that can be separated into 3 types:

  • Isometric, the direction of viewing is such that the three axes of space appear equally foreshortened, and there is a common angle of 120° between them. It's the most used type of axonometric projection. It was used a lot in technical drafting as it could easily be drafted using a 30°/60° triangle.
    The current axonometric view in FreeCAD is isometric.
  • Dimetric, the direction of viewing is such that two of the three axes of space appear equally foreshortened, of which the attendant scale and angles of presentation are determined according to the angle of viewing; the scale of the third direction is determined separately.
  • Trimetric, the direction of viewing is such that all of the three axes of space appear unequally foreshortened. The scale along each of the three axes and the angles among them are determined separately as dictated by the angle of viewing.
https://en.wikipedia.org/wiki/Axonometric_projection

Image


Please note that the NaviCube code has commands wrongly named "ViewTrimetric" and "ViewDimetric", I reported the error here:
Re: PR #1469 Qt5 compatible NaviCube

As I wrote in the link, it would be great to have dimetric and trimetric view orientations available. This would require the current axonometric to be renamed isometric.

EDIT: found a very old topic of mine about it, with some vector values I had figured out for the Drawing workbench... Part View Direction in Drawing Workbench
TheMarkster
Veteran
Posts: 5513
Joined: Thu Apr 05, 2018 1:53 am

Re: Starting a sketch, how about select plane in 3D space

Post by TheMarkster »

Thanks for the feedback, Normand. It's very helpful. It makes more sense to adjust camera orientation on new document creation rather than on new sketch creation. If you can provide the Rotation() numbers for each view you'd like and a name for each, that would be helpful.

I'm thinking of doing away with the preference dialog altogether and just have the preference in Tools -> Edit parameters. That would greatly simplify the coding, reduce the probability of bugs, and also make the code easier to maintain in the long run. Would be a bit more complicated for the user maybe, but it would still be fairly simple if it's well-documented in the wiki. (But having the option to use the current camera orientation is convenient.)

Here's what I'm thinking, a parameter in Base/Preferences/General named something like "CamOrientationOnNewDocCreation". This would be a text string parameter with support for these options:

Top
Bottom
Left
Right
Rear
Axonometric
Trimetric
Dimetric
Isometric
Rotation(.5,.5,.5,.5)


Top could be the default, since that's what it already is, or it could also be one of the others. If Axonometric is the same as one of the other metric views it would still be available as a choice simply because that's what everybody already understands. The Rotation() option could hold any set of 4 numbers. I just put the .5 's in there as examples. This option would give the user the ultimate flexibility in choosing any arbitrary camera angle.

Doesn't have to be in Preferences/General, could be in Preferences/Document, Preferences/OutputWindow, etc.

I'll have to look through FreeCAD source code to see where new documents are being created and insert the code there rather than where I have it now (where new sketches are created in PD).
freedman
Veteran
Posts: 3474
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: Starting a sketch, how about select plane in 3D space

Post by freedman »

I was working on a reply but NormandC got to it first. What he can convey in 300 words would take me 2000. Thank you.

I do see one issue, my goal was to get the first time user to see planes and pad in a 3D view. This means the default (first time the program is used after unzip) will need to be set to Dimetric (or such). This seems OK to me but the Arch, Draft folks might need to adjust the "CamOrientationOnNewDocCreation" to "Top". I still think it's worth it to see the initial views in 3D and even the Arch folks might like to see their first wall in 3D.

Thanks for working on this.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Starting a sketch, how about select plane in 3D space

Post by NormandC »

TheMarkster wrote: Sun Oct 14, 2018 5:48 pm Top could be the default, since that's what it already is, or it could also be one of the others.
freedman wrote: Sun Oct 14, 2018 6:42 pm This means the default (first time the program is used after unzip) will need to be set to Dimetric (or such). This seems OK to me but the Arch, Draft folks might need to adjust the "CamOrientationOnNewDocCreation" to "Top".
Like freedman I would prefer axonometric to be default. Ultimately, I think this is something that will have to be addressed by a "Set up Wizard" that would open the first time FreeCAD is launched (like LibreCAD does). See issue #3393, WikiLab is already working on this. Dedicated topic is here: https://forum.freecadweb.org/viewtopic. ... 0&p=242705

TheMarkster wrote: Sun Oct 14, 2018 5:48 pm If you can provide the Rotation() numbers for each view you'd like and a name for each, that would be helpful.
We're talking about quaternions here, right? That's like Mandarin to me. :? It will take me forever to find the proper values by trial and error; while I already figured out the x,y,z vector with rotation for Drawing views in the old topic I linked. Is there an easy way to convert a xyz vector into quaternions?


Image

Image


Nope, just tried these numbers to modify the placement of a cube, and it gives a completely different orientation. :|

TheMarkster wrote: Sun Oct 14, 2018 5:48 pm I'm thinking of doing away with the preference dialog altogether and just have the preference in Tools -> Edit parameters. That would greatly simplify the coding, reduce the probability of bugs, and also make the code easier to maintain in the long run.
As you say it makes it a little less accessible to end users, but the important thing is to get it into FreeCAD so I'm OK with that. I'm guessing it can always be exposed in the Preferences dialog later on?

On the other hand, it would be nice to get menu entries for dimetric and trimetric, in View --> Standard Views. Would that be complicated?

freedman wrote: Sun Oct 14, 2018 6:42 pm Thanks for working on this.
+1 :)
User avatar
HarryvL
Veteran
Posts: 1337
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: Starting a sketch, how about select plane in 3D space

Post by HarryvL »

NormandC wrote: Sun Oct 14, 2018 7:41 pm
TheMarkster wrote: Sun Oct 14, 2018 5:48 pm Top could be the default, since that's what it already is, or it could also be one of the others.
freedman wrote: Sun Oct 14, 2018 6:42 pm This means the default (first time the program is used after unzip) will need to be set to Dimetric (or such). This seems OK to me but the Arch, Draft folks might need to adjust the "CamOrientationOnNewDocCreation" to "Top".
Like freedman I would prefer axonometric to be default. Ultimately, I think this is something that will have to be addressed by a "Set up Wizard" that would open the first time FreeCAD is launched (like LibreCAD does). See issue #3393, WikiLab is already working on this. Dedicated topic is here: https://forum.freecadweb.org/viewtopic. ... 0&p=242705

TheMarkster wrote: Sun Oct 14, 2018 5:48 pm If you can provide the Rotation() numbers for each view you'd like and a name for each, that would be helpful.
We're talking about quaternions here, right? That's like Mandarin to me. :? It will take me forever to find the proper values by trial and error; while I already figured out the x,y,z vector with rotation for Drawing views in the old topic I linked. Is there an easy way to convert a xyz vector into quaternions?


Image

Image


Nope, just tried these numbers to modify the placement of a cube, and it gives a completely different orientation. :|

TheMarkster wrote: Sun Oct 14, 2018 5:48 pm I'm thinking of doing away with the preference dialog altogether and just have the preference in Tools -> Edit parameters. That would greatly simplify the coding, reduce the probability of bugs, and also make the code easier to maintain in the long run.
As you say it makes it a little less accessible to end users, but the important thing is to get it into FreeCAD so I'm OK with that. I'm guessing it can always be exposed in the Preferences dialog later on?

On the other hand, it would be nice to get menu entries for dimetric and trimetric, in View --> Standard Views. Would that be complicated?

freedman wrote: Sun Oct 14, 2018 6:42 pm Thanks for working on this.
+1 :)
I didn't follow the whole thread of posts, but one thing caught my eye: Quaternions.

I hope you are familiar with Geometric Algebra. It does away with the use of Quaternions for rotations and defines a geometric product instead that achieves the same. It is much, much more intuitive and works with bi-vectors. You can see how it works here:

http://www.faculty.luther.edu/~macdonal/GA&GC.pdf

Anyway, as I say, I didn't digest the whole topic, but whenever I see Quaternions mentioned I feel the need to mention this as a simple alternative.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Starting a sketch, how about select plane in 3D space

Post by NormandC »

LOL. As soon as you mention geometric algebra, my brain overloads and shuts down. I mean, seriously. What I do all day is create and manipulate simple to moderately complex parts and assemblies in a 3D view using a graphical user interface and a computer mouse. Abstracts like algebra formula is most definitely NOT my definition of "simple" or "intuitive".

I mentioned quaternions because 4 values are needed in the camera view orientation that TheMarkster is programming. I have no clue if they are indeed quaternions - I've read that they are used in 3D graphics. What you propose is probably not usable here.

Besides: please avoid quoting whole replies. It contributes nothing useful to a topic and only serves to make the topic longer. We do not need to see what I wrote twice, along with the people I quoted myself. Since you replied immediately after my reply, no quoting was necessary. Otherwise, please only quote the relevant part of a reply. Thank you.
TheMarkster
Veteran
Posts: 5513
Joined: Thu Apr 05, 2018 1:53 am

Re: Starting a sketch, how about select plane in 3D space

Post by TheMarkster »

NormandC wrote: Sun Oct 14, 2018 7:41 pm
We're talking about quaternions here, right? That's like Mandarin to me. :? It will take me forever to find the proper values by trial and error; while I already figured out the x,y,z vector with rotation for Drawing views in the old topic I linked. Is there an easy way to convert a xyz vector into quaternions?
Quaternions, yes
q0 = x, q1 = y, q2 = z and q3 = w, where the quaternion is specified by q=w+xi+yj+zk.
If you can move the camera in the 3d view and get the view you like, then enter this into the python console:

Code: Select all

Gui.ActiveDocument.activeView().getCameraOrientation()
you'll get the 4 numbers.

Another way to make a Rotation object is to use a from vector and a to vector:

Code: Select all

from FreeCAD import Base
fromV = Base.Vector(0,0,1) #standard top view, I think
toV = Base.Vector(.43,.32,.25) #trimetric?
view = Gui.ActiveDocument.activeView()
view.setCameraOrientation(Base.Rotation(fromV,toV))
view.getCameraOrientation() 
Trimetric Output: Rotation (-0.32075151248890804, 0.4310098514262281, 0.0, 0.8434150669804392)

Code: Select all

from FreeCAD import Base
fromV = Base.Vector(0,0,1) #standard top view, I think
toV = Base.Vector(.4,.1,.4) #dimetric?
view = Gui.ActiveDocument.activeView()
view.setCameraOrientation(Base.Rotation(fromV,toV))
view.getCameraOrientation() 
Dimetric Output: Rotation (-0.09450947699730448, 0.37803790798921794, 0.0, 0.9209534727014344)

Code: Select all

from FreeCAD import Base
fromV = Base.Vector(0,0,1) #standard top view, I think
toV = Base.Vector(.4,.4,.4) #isometric?
view = Gui.ActiveDocument.activeView()
view.setCameraOrientation(Base.Rotation(fromV,toV))
view.getCameraOrientation() 
Isometric Output: Rotation (-0.3250575853959737, 0.3250575853959737, 0.0, 0.8880738327149823)
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Starting a sketch, how about select plane in 3D space

Post by DeepSOIC »

As for zoom level, I had an idea long long ago... to have a scale-bar somewhere near 3d view, that would tell one about overall zoom level. Something like this:
scale-bar-idea.png
scale-bar-idea.png (157.61 KiB) Viewed 774 times
chrisb
Veteran
Posts: 54293
Joined: Tue Mar 17, 2015 9:14 am

Re: Starting a sketch, how about select plane in 3D space

Post by chrisb »

Good idea. And I admire your painting capabilities.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply