How DatumPlane's supposed to be displayed

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
Fat-Zer
Posts: 176
Joined: Thu Oct 30, 2014 10:38 pm

How DatumPlane's supposed to be displayed

Post by Fat-Zer »

Hello, now I'm adding the origins to the body, generally it wasn't too hard... But now I'm a bit stuck with the visualization of origin and datum sizes... They are both depend on the bounding box of internal objects, so I want to handle them in a common way. Also now the ViewProviderDatum's are notified that they need to update size by updateData(<placement property>), which is a bit hacky, so I want to refactor that to...

As for implementation of ViewProviderDatumPlane::updateData, the plane supposed to be displayed as any of basic shapes listed here:
http://cococubed.asu.edu/code_pages/raybox.shtml
But due to a mistake in it (the bounding box is rotated rather than the basepoint/normal), the output happends always to be a rectangle.

So now I can either fix the code, so plane will have different shape depending on it's intersection with bounding box or simplify it: the same result as now may be achived in a couple of dozens of lines (the current code is more than 150 lines)...
What do you think?
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: How DatumPlane's supposed to be displayed

Post by DeepSOIC »

I think a rectangular shape is all right, as it is quite easy to understand its orientation. As for the true intersection with bounding box cuboid, I don't know. I think I want to play with it a bit before giving preference to one or the other.
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: How DatumPlane's supposed to be displayed

Post by ickby »

I would prefere a minimal rectangle, means a rectangle with minimal width and hight to enclose the part (plus some margin). It should also always contain the origin (0,0,0) The reason for this is that a rectangle will always be recocnized as a plane, so there is no confusion like "what is this strange shape", it provides a clear and recognizable visual aid. And including the origin is imho important to get a feeling where the named origin really is if the single body of the part is somewhere non-centric.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: How DatumPlane's supposed to be displayed

Post by triplus »

Fat-Zer wrote:But now I'm a bit stuck with the visualization of origin and datum sizes... They are both depend on the bounding box of internal objects, so I want to handle them in a common way.
Slightly unrelated but still quite close to the subject. As sometimes objects can have proportions where for example length is much bigger compared to width/height 2 planes could become too small in that condition? Therefore probably bounding box is one criteria to determine the plane size but there should be additional criteria like for example "min-size" based on screen size?

And i am not sure if this is DatumPlane related but in PartDesign NEXT default sketcher area when entering the sketch for inserting sketcher geometry is appropriate for inserting sketcher geometry at about 1mm * 1mm size. Default sketcher area size probably could be bumped up a bit.
Fat-Zer
Posts: 176
Joined: Thu Oct 30, 2014 10:38 pm

Re: How DatumPlane's supposed to be displayed

Post by Fat-Zer »

ickby wrote:I would prefer a minimal rectangle, means a rectangle with minimal width and hight to enclose the part (plus some margin).
Yes, I think rectangular planes are better too... So I'll keep them... Note that due to implementation the rectangle is minimal (+0.1 marging) for planes parallel to the baseplanes, for others it is larger (up to sqrt(3) times for worst case). To calculate the best case for any position of the plane will be too time-hungry... I suppose it will be still possible to enhance the current a bit, but I don't yet know how exactly...
triplus wrote:Slightly unrelated but still quite close to the subject. As sometimes objects can have proportions where for example length is much bigger compared to width/height 2 planes could become too small in that condition? Therefore probably bounding box is one criteria to determine the plane size but there should be additional criteria like for example "min-size" based on screen size?
Doesn't quite understood that... are you talking about Origin's planes or Datums?
triplus wrote:And i am not sure if this is DatumPlane related but in PartDesign NEXT default sketcher area when entering the sketch for inserting sketcher geometry is appropriate for inserting sketcher geometry at about 1mm * 1mm size. Default sketcher area size probably could be bumped up a bit.
This one is not related... It's because PartDesign implements it's own new_sketch command with an object picker, which doesn't sets the viewport correctly after the creation. IMHO it's subject to fix... remind that a bit later...
drei
Posts: 479
Joined: Sun May 11, 2014 7:47 pm
Location: Mexico
Contact:

Re: How DatumPlane's supposed to be displayed

Post by drei »

Please pardo the intrusion,
I'd like to suggest that we keep the rectangular shape, but add transparency please (it's been a while since I used this branch, but last time I used it I was unable to change transparency even in the Object's properties from GUI.)

Also, if someone finds it interesting/useful here's Siemens NX implementation of planes: https://docs.plm.automation.siemens.com ... om_plane_d
Need help? Feel free to ask, but please read the guidelines first
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: How DatumPlane's supposed to be displayed

Post by triplus »

Fat-Zer wrote:
triplus wrote:Slightly unrelated but still quite close to the subject. As sometimes objects can have proportions where for example length is much bigger compared to width/height 2 planes could become too small in that condition? Therefore probably bounding box is one criteria to determine the plane size but there should be additional criteria like for example "min-size" based on screen size?
Doesn't quite understood that... are you talking about Origin's planes or Datums?
Basically Origin Planes and Datum Planes. True i gave example for Origin Planes but as for Datum Planes imagine user creates "small" 2D cross section on it and after extrudes is by using "big" value. If bounding box is the only criteria for the plane size what probably can happen is plane becomes to small to be usable without user zooming in first.
This one is not related... It's because PartDesign implements it's own new_sketch command with an object picker, which doesn't sets the viewport correctly after the creation. IMHO it's subject to fix... remind that a bit later...
issue #0002244
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: How DatumPlane's supposed to be displayed

Post by jriegel »

Remember:
ViewProvider can have additional Properties. So, if there is a long discussion about the right way, just make it configurable.

And if you use some kind of margins, never use absolute values. Always try to use things like 1% of the BoundingBox...
Stop whining - start coding!
Fat-Zer
Posts: 176
Joined: Thu Oct 30, 2014 10:38 pm

Re: How DatumPlane's supposed to be displayed

Post by Fat-Zer »

drei wrote:Please pardo the intrusion,
I'd like to suggest that we keep the rectangular shape, but add transparency please (it's been a while since I used this branch, but last time I used it I was unable to change transparency even in the Object's properties from GUI.)
Datums are semi-transparent by default for a quite a long time (I haven't seen them solid)...

I've just today made them support common object properties like color and transparancy... Also I've slightly changing their default color: the current one (E6E621) is too near to the highlight color (E1E114), I've set the "golden yellow" (FFD700) and increased their transparency to 60, for planes it was 50, and for lines — 20. Also I've disabled transparency for the points due to it completely broke them (because of SoMarkerSet)... Also note that points a lack of highlight...
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: How DatumPlane's supposed to be displayed

Post by triplus »

jriegel wrote:Remember:
ViewProvider can have additional Properties. So, if there is a long discussion about the right way, just make it configurable.

And if you use some kind of margins, never use absolute values. Always try to use things like 1% of the BoundingBox...
Probably we are talking about slightly different thing.

1.) General behaviour and minimal sizes of planes in 3D View.
2.) Property for each individual plane. For user to control individual plane size.

As for option 2:

Yes i agree for this it could make sense to be done in percentages compared to original size that is determined by BoundingBox.

As for option 1 (initial proposal):

I think it would not help much in this use case to have the possibility to set for example BoundingBox + 10% to set the plane size. Small plane would still be small. Min-size general property therefore should be calculated based on 3D View window size and if the plane is bigger BoundingBox is the only criteria that determines how big it should be. Therefore if user would set min-size to 5 what FreeCAD would do is it would never show plane in 3D View smaller of 5% of the 3D View size.

P.S. I don't have strong opinion on this. I just thought i will mention possible use case to discuss. But it is true i am not aware of implications and performance penalty and how should actual implementation be done or behave. There is a chance other users would always like to zoom in in such use cases instead of having min-size for planes as a general option. If that is true i am fine with that.
Post Reply