GD&T Workbench for FreeCAD

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Cuq
Posts: 145
Joined: Tue Jul 06, 2021 10:07 am

Re: GD&T Workbench for FreeCAD

Post by Cuq »

Ok thanks for these answers.

As the recovery of the face on which the Feature is attached is done with the instruction :

Code: Select all

FreeCADGui.Selection.getSelectionEx()
How to recover the corresponding reference from the function to the body ? And is it really necessar, knowing that if the surfaces are modified at the end there is a strong chance that the reference on the body is also invalid?
aapo
Posts: 615
Joined: Mon Oct 29, 2018 6:41 pm

Re: GD&T Workbench for FreeCAD

Post by aapo »

user1234 wrote: Fri Mar 17, 2023 12:14 am It is only a warning. You reference elements (face, lines, vertex) from features (in that case probably Pocket001), not the whole Body, outside the Body. This means when you add a feature to the Body (for example a fillet), it will not be considered. It still references to the not last visible feature.
It's not only about what feature is referenced; it's also a specific warning that you are referencing the feature from outside the Body, and are thus losing the placement and coordinate system information of the body (for your link). That is because every Body has a single GeoFeatureGroup, which modifies the coordinate system of each feature inside the Body according to this GeoFeatureGroup. If you link a feature inside a Body to somewhere outside the Body, you lose this GeoFeatureGroup coordinate transformation, hence the warning.

In practice, this warning should tell the user that the linked version of the object it complains about may appear in a very weird place in the global coordinate system (and may jump around in a seemingly random fashion when you edit your model). Of course, if you don't care at all about the placement/coordinate system of whatever you are linking, you can ignore the warning.

In this particular case, I think that the GD&T drawings would fail to follow the Body when the Body is moved around. So, for example, if one makes an assembly out of the bodies, the GD&T drawings would appear in completely wrong places after assembling (probably staying where the Body was originally located before assembly). Thus, in this case this warning would be pretty relevant and should be taken seriously.

viewtopic.php?t=23373
aapo
Posts: 615
Joined: Mon Oct 29, 2018 6:41 pm

Re: GD&T Workbench for FreeCAD

Post by aapo »

Cuq wrote: Fri Mar 17, 2023 1:07 am Ok thanks for these answers.

As the recovery of the face on which the Feature is attached is done with the instruction :

Code: Select all

FreeCADGui.Selection.getSelectionEx()
How to recover the corresponding reference from the function to the body ? And is it really necessar, knowing that if the surfaces are modified at the end there is a strong chance that the reference on the body is also invalid?
In practice you should use instead the most parent object derived from the selection:

Code: Select all

FreeCADGui.Selection.getSelectionEx("", 0)
Please see the screenshot below and note the difference, using the first variant with 0 would give you the Body object and get rid of the warning, I think.

20230317 getSelectionEx-pic01.png
20230317 getSelectionEx-pic01.png (65.47 KiB) Viewed 1571 times
user1234
Veteran
Posts: 3345
Joined: Mon Jul 11, 2016 5:08 pm

Re: GD&T Workbench for FreeCAD

Post by user1234 »

aapo wrote: Fri Mar 17, 2023 3:52 pm It's not only about what feature is referenced; it's also a specific warning that you are referencing the feature from outside the Body, and are thus losing the placement and coordinate system information of the body (for your link).

True, i have forgotten that. Also that in that case it is important, not only a warning.


Greetings
user1234
User avatar
Cuq
Posts: 145
Joined: Tue Jul 06, 2021 10:07 am

Re: GD&T Workbench for FreeCAD

Post by Cuq »

Will be a very long Road to get something acceptable

Trying to list the issues / enhancements to add to this WB : https://github.com/5axes/FreeCAD-GDT/issues
User avatar
Cuq
Posts: 145
Joined: Tue Jul 06, 2021 10:07 am

Re: GD&T Workbench for FreeCAD

Post by Cuq »

Switch the Code to a Full Text Notation ( No more Mix Text / SVG Image)
FullText.PNG
FullText.PNG (2.95 KiB) Viewed 1390 times
Could have some serious Issue with previous Project but as This project is more a POC than a real WB Should not be an issue right Now :

https://github.com/5axes/FreeCAD-GDT/tree/Without_SVG

Pro : Can size the police /customize for every Symbol and Text / Don't need to create SVG file for every symbol
Cons : Must Use a compatible Police (osifont -> Iso-Gps)
user1234
Veteran
Posts: 3345
Joined: Mon Jul 11, 2016 5:08 pm

Re: GD&T Workbench for FreeCAD

Post by user1234 »

Sounds promising! Even 2D drawings will never die, for internal documentations or internal drawings this will be a very good feature, since 2D drawings needs often much more time, especially for assembly drawings.


Greetings
user1234
User avatar
Cuq
Posts: 145
Joined: Tue Jul 06, 2021 10:07 am

Re: GD&T Workbench for FreeCAD

Post by Cuq »

Well, I still have problems with the management of the elements inside a Group ("App::DocumentObjectGroupPython") but I'm making some progress.

I added a structure for the management of entities, which is more in line with what already exists in other CAD software like CATIA for example.

There is now a group for the Datum System, which is common to all entities.

And we have a group for each annotation plane where we can have DATUMs and/or geometric tolerances. I hope that in the future we can also add TEDs.
Groupe.PNG
Groupe.PNG (23.98 KiB) Viewed 1265 times
Well clearly my skills in Python and especially in FreeCAD API are very limited. The advantage of this WB is that its state just after the draft should allow me to gradually increase my knowledge (we all needs to start from somewhere).

Despite my efforts I have not yet been able to solve the problem:

FeaturePython: Link(s) to object(s) 'xxxx' go out of the allowed scope
https://github.com/5axes/FreeCAD-GDT/issues/3

I tried to apply @aapo suggestions but unfortunately it doesn't solve the problem. On the other hand, even in an assembly it doesn't seem to be a problem for the placement of GD&T entities. But my knowledge of FreeCad does not allow me to judge the importance of this message. If it was just informative in the end it still raises the problem of the multiplication of notifications.
Assembly.png
Assembly.png (17.88 KiB) Viewed 1259 times
&

Object can only be in a single Group
https://github.com/5axes/FreeCAD-GDT/issues/2


These are the 2 problems that I absolutely must solve before moving forward a little more on the new function.


However if someone could help me on the Python coding part it would be a great Help (and a lot of saving time). On the other hand this WB was dead for 5 years so it will wait another 5 years for my meager contribution to bring it out of the nothingness it was in.
User avatar
Cuq
Posts: 145
Joined: Tue Jul 06, 2021 10:07 am

GD&T Workbench for FreeCAD

Post by Cuq »

Change The Lower/Upper Tolerance Annotation
UpperLower.PNG
UpperLower.PNG (9.89 KiB) Viewed 1161 times
User avatar
Cuq
Posts: 145
Joined: Tue Jul 06, 2021 10:07 am

Re: GD&T Workbench for FreeCAD

Post by Cuq »

aapo wrote: Fri Mar 17, 2023 4:34 pm In practice you should use instead the most parent object derived from the selection:

Code: Select all

FreeCADGui.Selection.getSelectionEx("", 0)
Please see the screenshot below and note the difference, using the first variant with 0 would give you the Body object and get rid of the warning, I think.

20230317 getSelectionEx-pic01.png
In practice the problem with :

Code: Select all

FreeCADGui.Selection.getSelectionEx("", 0)
Gives a different result if you are in a Part or not. The root of the object is not the same and therefore the code does not work.
ObjectName.png
ObjectName.png (29.33 KiB) Viewed 1067 times
Post Reply