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!
Post Reply
juanvanyo
Posts: 16
Joined: Sat Dec 10, 2016 12:14 am
Location: Spain

GD&T Workbench for FreeCAD

Post by juanvanyo »

Hi all,

During the development of my final master's work in university I developed a module to solve the problem of Geometric Dimensioning and Tolerancing (GD&T).

Abstract

The project is aimed at the development of a labeling software module for Geometric Dimensioning and Tolerancing (GD&T) in 2D and 3D technical drawings. The main contributions of this software are:

Allows the GD&T information to be added to the design itself, thus linking design, manufacturing and quality specifications.
Implements the ISO16792 standard for both 2D and 3D parts.
Incorporates a homogeneous graphical interface and integrated with the technical design tools and 3D.
There is no precedent developed as free software.
The implementation of the software is done as a module of the parametric modeling free software application FreeCAD. This is a multiplatform project since the development of the module is done with Python and FreeCAD has compilations for multiple Operating Systems.

GitHub repository: https://github.com/juanvanyo/FreeCAD-GDT

I add some screenshots:
interfaceGDT.png
interfaceGDT.png (420.57 KiB) Viewed 12980 times
AP.png
AP.png (491.15 KiB) Viewed 12980 times
DF.png
DF.png (495.01 KiB) Viewed 12980 times
DS.png
DS.png (141.19 KiB) Viewed 12980 times
GT.png
GT.png (285.2 KiB) Viewed 12980 times
Last edited by juanvanyo on Fri Apr 28, 2017 11:30 am, edited 1 time in total.
cox
Posts: 971
Joined: Wed Nov 26, 2014 11:37 pm

Re: GD&T Workbenk for FreeCAD

Post by cox »

Wow, looks great. Have no clue how to use it :-) More to learn. Thanks
Need help? Feel free to ask, but please read the guidelines first
User avatar
nemesis
Posts: 372
Joined: Tue Mar 25, 2014 11:24 pm
Location: France, Lyon

Re: GD&T Workbenk for FreeCAD

Post by nemesis »

Hi,
looks very interesting. good job
Does it work on both 0.16 and 0.17?
do you have a short tutorial or a short workflow explanation?

on both I have this error while trying to create an annotation plane :

Code: Select all

Running the Python command 'dd_annotationPlane' failed:
Traceback (most recent call last):
  File "/Volumes/doc/Thierry/Library/Preferences/FreeCAD/Mod/FreeCAD-GDT/annotationPlane.py", line 38, in Activated
    showGrid()
  File "/Volumes/doc/Thierry/Library/Preferences/FreeCAD/Mod/FreeCAD-GDT/GDT.py", line 230, in showGrid
    FreeCADGui.Snapper.show()
  File "/Applications/FreeCAD/FreeCAD 016.app/Contents/Mod/Draft/DraftSnap.py", line 1193, in show
    self.setTrackers()
  File "/Applications/FreeCAD/FreeCAD 016.app/Contents/Mod/Draft/DraftSnap.py", line 1221, in setTrackers
    self.grid = DraftTrackers.gridTracker()
  File "/Applications/FreeCAD/FreeCAD 016.app/Contents/Mod/Draft/DraftTrackers.py", line 782, in __init__
    self.reset()
  File "/Applications/FreeCAD/FreeCAD 016.app/Contents/Mod/Draft/DraftTrackers.py", line 836, in reset
    self.update()
  File "/Applications/FreeCAD/FreeCAD 016.app/Contents/Mod/Draft/DraftTrackers.py", line 793, in update
    if i/float(self.mainlines) == i/self.mainlines:

float division by zero
juanvanyo
Posts: 16
Joined: Sat Dec 10, 2016 12:14 am
Location: Spain

Re: GD&T Workbenk for FreeCAD

Post by juanvanyo »

nemesis wrote:Hi,
looks very interesting. good job
Does it work on both 0.16 and 0.17?
do you have a short tutorial or a short workflow explanation?

on both I have this error while trying to create an annotation plane :

Code: Select all

Running the Python command 'dd_annotationPlane' failed:
Traceback (most recent call last):
  File "/Volumes/doc/Thierry/Library/Preferences/FreeCAD/Mod/FreeCAD-GDT/annotationPlane.py", line 38, in Activated
    showGrid()
  File "/Volumes/doc/Thierry/Library/Preferences/FreeCAD/Mod/FreeCAD-GDT/GDT.py", line 230, in showGrid
    FreeCADGui.Snapper.show()
  File "/Applications/FreeCAD/FreeCAD 016.app/Contents/Mod/Draft/DraftSnap.py", line 1193, in show
    self.setTrackers()
  File "/Applications/FreeCAD/FreeCAD 016.app/Contents/Mod/Draft/DraftSnap.py", line 1221, in setTrackers
    self.grid = DraftTrackers.gridTracker()
  File "/Applications/FreeCAD/FreeCAD 016.app/Contents/Mod/Draft/DraftTrackers.py", line 782, in __init__
    self.reset()
  File "/Applications/FreeCAD/FreeCAD 016.app/Contents/Mod/Draft/DraftTrackers.py", line 836, in reset
    self.update()
  File "/Applications/FreeCAD/FreeCAD 016.app/Contents/Mod/Draft/DraftTrackers.py", line 793, in update
    if i/float(self.mainlines) == i/self.mainlines:

float division by zero
I think there is a problem with the attributes of the grid, which I try to get from the configurations of the Part module. Maybe if you enter the Preferences configuration of the Part module, the problem will be solved.

Tonight I will try to make a short explanation of the workflow.
akredd
Posts: 71
Joined: Wed Mar 19, 2014 8:31 pm
Location: D-02733 Cunewalde

Re: GD&T Workbenk for FreeCAD

Post by akredd »

Hi,
your images looks very impressive.
My problem: after downloading to ~/.FreeCAD/Mod and unzip the file a directory FreeCAD-GDT-master with all your files is in Mod. After restarting FreeCAD I can't see a WB "GD&T :(
There are a lot of other WB I installed in Mod and they work correct. So, I can't find my mistake.

My configuration:
OS: Ubuntu 16.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10950 (Git)
Build type: None
Branch: master
Hash: 6368b2f822cf838ee6c50ebf62480ff86c214317
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
juanvanyo
Posts: 16
Joined: Sat Dec 10, 2016 12:14 am
Location: Spain

Re: GD&T Workbenk for FreeCAD

Post by juanvanyo »

nemesis wrote:Hi,
looks very interesting. good job
Does it work on both 0.16 and 0.17?
do you have a short tutorial or a short workflow explanation?

on both I have this error while trying to create an annotation plane :

Code: Select all

Running the Python command 'dd_annotationPlane' failed:
Traceback (most recent call last):
  File "/Volumes/doc/Thierry/Library/Preferences/FreeCAD/Mod/FreeCAD-GDT/annotationPlane.py", line 38, in Activated
    showGrid()
  File "/Volumes/doc/Thierry/Library/Preferences/FreeCAD/Mod/FreeCAD-GDT/GDT.py", line 230, in showGrid
    FreeCADGui.Snapper.show()
  File "/Applications/FreeCAD/FreeCAD 016.app/Contents/Mod/Draft/DraftSnap.py", line 1193, in show
    self.setTrackers()
  File "/Applications/FreeCAD/FreeCAD 016.app/Contents/Mod/Draft/DraftSnap.py", line 1221, in setTrackers
    self.grid = DraftTrackers.gridTracker()
  File "/Applications/FreeCAD/FreeCAD 016.app/Contents/Mod/Draft/DraftTrackers.py", line 782, in __init__
    self.reset()
  File "/Applications/FreeCAD/FreeCAD 016.app/Contents/Mod/Draft/DraftTrackers.py", line 836, in reset
    self.update()
  File "/Applications/FreeCAD/FreeCAD 016.app/Contents/Mod/Draft/DraftTrackers.py", line 793, in update
    if i/float(self.mainlines) == i/self.mainlines:

float division by zero
Problem solved with my last update. It was due to a conflict with the Draft module. You may have to enter the Draft module preferences (Grid and snapping) and put the following values: Main lines every 10, Grid size 100.
juanvanyo
Posts: 16
Joined: Sat Dec 10, 2016 12:14 am
Location: Spain

Re: GD&T Workbenk for FreeCAD

Post by juanvanyo »

akredd wrote:Hi,
your images looks very impressive.
My problem: after downloading to ~/.FreeCAD/Mod and unzip the file a directory FreeCAD-GDT-master with all your files is in Mod. After restarting FreeCAD I can't see a WB "GD&T :(
There are a lot of other WB I installed in Mod and they work correct. So, I can't find my mistake.

My configuration:
OS: Ubuntu 16.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10950 (Git)
Build type: None
Branch: master
Hash: 6368b2f822cf838ee6c50ebf62480ff86c214317
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
I think your issue has been fixed with my latest update. Thanks for your interest.
juanvanyo
Posts: 16
Joined: Sat Dec 10, 2016 12:14 am
Location: Spain

Re: GD&T Workbenk for FreeCAD

Post by juanvanyo »

Operation of the module:

When doing a GD&T labeling, the first thing to do is to define an annotation plane on which the annotations we make will be painted. To do this, first select a face of the piece and click the command on the toolbar add annotation plane. This will define a plane on that face and we can also apply an offset to place our annotation plane to the height we want in parallel on the selected face. Defining an annotation plane.

The next step we must do is to create a datum reference or a geometric tolerance. Although it is important to note that if the first thing to be created is a geometric tolerance, it can not contain any datum system since there will not be any created yet. However, this can be added later by modifying the geometric tolerance from the inventory of GD&T elements.

In any case, when creating a datum reference or a geometric characteristic, the user must choose some parameters that will define the element to be created. These include the annotation plane on which the annotation will be represented. Everything followed should select a point on the plane. Point on which will start the representation of the frame that will encapsulate the data of our annotation.

In addition, at any time, you can create a datum system with the datum reference elements that have been created and this system can be applied to the geometric tolerances that we consider appropriate. This will indicate that said geometric tolerance will be applied to the face or faces corresponding to the annotation with respect to the datum references that make up the associated datum system.

Subsequently, if you want to apply a datum reference or a geometric tolerance to a face or faces that already have an annotation associated with it, this module will automatically detect which annotation is and it will add the new element to that annotation.

Therefore, the running of our module could be summarized in that we have to add geometric tolerances to our design but in order to carry this out, we would first have to create different elements like annotation planes to place our annotation in the desired place, or Datum references and datum systems to provide necessary information to our geometric tolerances. So we have to create different elements until we have our piece completely labeled with all the geometric tolerances that we need to indicate.

Commands:
  • Add Annotation Plane
    addAnnotationPlane.png
    addAnnotationPlane.png (30.7 KiB) Viewed 12902 times
    Add Datum Feature
    addDatumFeature.png
    addDatumFeature.png (30.7 KiB) Viewed 12902 times
    Add Datum System
    addDatumSystem.png
    addDatumSystem.png (30.7 KiB) Viewed 12902 times
    Add Geometric Tolerance
    addGeometricTolerance.png
    addGeometricTolerance.png (30.7 KiB) Viewed 12902 times
    Inventory of the elements of GD&T
    inventory.png
    inventory.png (30.7 KiB) Viewed 12902 times
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: GD&T Workbenk for FreeCAD

Post by NormandC »

This is awesome. Great work Juan!

It's a pity though that this info will surely be lost at STEP export as I doubt FreeCAD's STEP exporter supports this.
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: GD&T Workbenk for FreeCAD

Post by ickby »

NormandC wrote:It's a pity though that this info will surely be lost at STEP export as I doubt FreeCAD's STEP exporter supports this.
Actually occ step importer does super it, and i suppose exporter too. So with some work it should be possible to include it in step. But don't know if it is somehow possible to make this available for modules if there is no gd&t data type in the part workbench, where the exporter lives.

https://www.opencascade.com/comment/19633

Great work by the way!
Post Reply