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
wandererfan
Veteran
Posts: 6317
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: GD&T Workbench for FreeCAD

Post by wandererfan »

juanvanyo wrote:Hi wandererfan, I can not reproduce your problem. Can you enter the following lines in the Python console?
Close, but I have extra round brackets & comma. Different Python version?

Code: Select all

Before Add Datum Feature
>>> import GDT
>>> GDT.getAllAnnotationObjects()[0].faces
Traceback (most recent call last):
  File "<input>", line 1, in <module>
IndexError: list index out of range
>>> 

After Add Datum Feature in dialog
>>> import GDT
>>> GDT.getAllAnnotationObjects()[0].faces
[(<Part::PartFeature>, ('Face6',))]
>>> 

After closing Add Datum Feature dialog
>>> import GDT
>>> GDT.getAllAnnotationObjects()[0].faces
[(<Part::PartFeature>, ('Face6',))]
>>> 
OS: Ubuntu 12.04.5 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10950 (Git)
Build type: debug
Branch: master
Hash: 6368b2f822cf838ee6c50ebf62480ff86c214317
Python version: 2.7.3
Qt version: 4.8.1
Coin version: 3.1.3
OCC version: 7.1.0
juanvanyo
Posts: 16
Joined: Sat Dec 10, 2016 12:14 am
Location: Spain

Re: GD&T Workbench for FreeCAD

Post by juanvanyo »

wandererfan wrote: Close, but I have extra round brackets & comma. Different Python version?
The code I use to extract the selected faces is as follows:

Code: Select all

>>> import GDT
>>> faces = []
>>> for i in range(len(GDT.getSelectionEx())):
...     for j in range(len(GDT.getSelectionEx()[i].SubElementNames)):
...         faces.append((GDT.getSelectionEx()[i].Object, GDT.getSelectionEx()[i].SubElementNames[j]))
>>> faces.sort()
>>> faces
[(<Part::PartFeature>, 'Face3')]
Maybe the extra comma is added depending of the Python version? Because in my code I'm just accessing an SubElementNames, not tuple.

With this code you get a list of tuples formed first by the part to which they belong and secondly by the subelement selected.

Another example when you have selected edges and faces: [(<Part::PartFeature>, 'Edge5'), (<Part::PartFeature>, 'Edge6'), (<Part::PartFeature>, 'Face2'), (<Part::PartFeature>, 'Face3'), (<Part::PartFeature>, 'Face6')]

OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6706 (Git)
Build type: Release
Branch: tag: 0.16.6706
Hash: f86a4e411ff7848dea98d7242f43b7774bee8fa0
Python version: 2.7.11
Qt version: 4.8.7
Coin version: 3.1.3
OCC version: 6.8.0.oce-0.17
User avatar
wandererfan
Veteran
Posts: 6317
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: GD&T Workbench for FreeCAD

Post by wandererfan »

juanvanyo wrote:Maybe the extra comma is added depending of the Python version?
My luck is no better on a different machine.

Code: Select all

Geometric Dimensioning & Tolerancing workbench activated
Traceback (most recent call last):
  File "/home/mruser/.FreeCAD/Mod/GDT/GDT.py", line 1171, in updateData
    fp.circumferenceBool = True if (True in [l.Closed for l in fp.faces[0][0].Shape.getElement(fp.faces[0][1]).Edges] and len(fp.faces[0][0].Shape.getElement(fp.faces[0][1]).Vertexes) == 2) else False
<type 'exceptions.TypeError'>: argument 1 must be string, not tuple
Traceback (most recent call last):
  File "/home/mruser/.FreeCAD/Mod/GDT/GDT.py", line 1451, in createObject
    obj = makeDatumFeature(self.textName, self.ContainerOfData)
  File "/home/mruser/.FreeCAD/Mod/GDT/GDT.py", line 834, in makeDatumFeature
    makeAnnotation(ContainerOfData.faces, ContainerOfData.annotationPlane, DF=obj, GT=[])
  File "/home/mruser/.FreeCAD/Mod/GDT/GDT.py", line 1243, in makeAnnotation
    obj.p1 = (obj.faces[0][0].Shape.getElement(obj.faces[0][1]).CenterOfMass).projectToPlane(obj.AP.PointWithOffset, obj.AP.Direction)
TypeError: argument 1 must be string, not tuple
FreeCAD: SoAsciiText.cpp:870: void SoAsciiTextP::setUpGlyphs(SoState*, SoAsciiText*): Assertion `length' failed.
/home/mruser/bin/fcmst.sh: line 6:  6077 Aborted                 (core dumped) ./FreeCAD -l
OS: Ubuntu 16.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10887 (Git)
Build type: debug
Branch: master
Hash: 67fc70dadae471cb3d77dcf5562b4a86ec79f95d
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: GD&T Workbench for FreeCAD

Post by Kunda1 »

@juanvanyo has the issue been fixed?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
fosselius
Posts: 381
Joined: Sat Apr 23, 2016 10:03 am
Contact:

Re: GD&T Workbench for FreeCAD

Post by fosselius »

Wow. Thanks for bringing this to my attention. Had not seen this before.

Sadly it looks like there have been no activity in the gitrepo the last year..
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: GD&T Workbench for FreeCAD

Post by Kunda1 »

fosselius wrote: Thu Aug 23, 2018 6:20 pm Wow. Thanks for bringing this to my attention. Had not seen this before.

Sadly it looks like there have been no activity in the gitrepo the last year..
@fosselius take a look at FreeCAD-Addons repo. There is a lot of cool stuff in there. :wink:
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
wandererfan
Veteran
Posts: 6317
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: GD&T Workbench for FreeCAD

Post by wandererfan »

fosselius wrote: Thu Aug 23, 2018 6:20 pm Wow. Thanks for bringing this to my attention. Had not seen this before.

Sadly it looks like there have been no activity in the gitrepo the last year..
If I recall correctly, this WB worked with v0.16 and Drawing WB but not with 0.17 and TechDraw. The 16/17 issue was a difference in how PropertyLinkSubList(??) returned its results. The Drawing/TD issue was the same one as DrawingDimensioning and TD. TD doesn't draw the display in SVG, so providing addon results as SVG isn't really helpful.

I think the author wrote the code as a thesis project, so if he got his degree, he may have lost interest.
cr7
Posts: 1
Joined: Sat Jan 12, 2019 11:20 am

Re: GD&T Workbench for FreeCAD

Post by cr7 »

Any news on this. I've tried this plugin on version 0.16 and 0.17, linux and it crashes pretty quick.
engdham
Posts: 47
Joined: Sun Jul 15, 2018 2:08 am
Location: Rondonópolis - MT - Brazil
Contact:

Re: GD&T Workbench for FreeCAD

Post by engdham »

It does not work with 0.18.3, sadly :(

Code: Select all

Init:      Initializing C:\Users\rstecman\AppData\Roaming\FreeCAD\Mod\GDT... failed
----------------------------------------------------------------------------------------------------
Traceback (most recent call last):
  File "<string>", line 120, in InitApplications
  File "<string>", line 48
    self.appendMenu("GD&T Tools",self.cmdList+self.inventory)
                                                            ^
TabError: inconsistent use of tabs and spaces in indentation
----------------------------------------------------------------------------------------------------
During initialization the error inconsistent use of tabs and spaces in indentation (<string>, line 48) occurred in C:\Users\rstecman\AppData\Roaming\FreeCAD\Mod\GDT\InitGui.py
Please look into the log file for further information
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: GD&T Workbench for FreeCAD

Post by Kunda1 »

This Addon is in need of a maintainer and update to py3/qt5

https://github.com/FreeCAD/FreeCAD-addons/issues/115
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply