MACRO:Work Feature 2014_12

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
cox
Posts: 971
Joined: Wed Nov 26, 2014 11:37 pm

Re: MACRO:Work Feature 2014_12

Post by cox »

easyw-fc wrote: any "print" occurrence will trig the error, not only "print message" I've found
Are you running python3?
Need help? Feel free to ask, but please read the guidelines first
User avatar
easyw-fc
Veteran
Posts: 3629
Joined: Thu Jul 09, 2015 9:34 am

Re: MACRO:Work Feature 2014_12

Post by easyw-fc »

cox wrote: Are you running python3?
No,
just using internal python of standard FC build for win 64 running on win10 64b
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: MACRO:Work Feature 2014_12

Post by HoWil »

rentlau_64 wrote:Hello!

A new release 2017-02-05 is available:
https://github.com/Rentlau/WorkFeature.git
Dear Rentlau_64,
I tested your wb the first time and came across some issues:
* 'Camera Track' in the 'View' dialog gives 'ERROR : No Edge was selected !No Edge was selected !' even if I selected a edge.
* 'Distance' and Length in 'Check' give 'Distance : 4e+100' .... even if the begin and end points are reported correctly.
* 'are Coplanar' does report

Code: Select all

Unable to check coplanarity : 
Select 2 objects 
(either 2 Planes or 2 Edges) !
even if I select two edges on one face of cube.

BR,
HoWil
rentlau_64
Posts: 181
Joined: Tue Oct 21, 2014 9:47 am
Location: Pau (France)

Re: MACRO:Work Feature 2014_12

Post by rentlau_64 »

HoWil,
Thank you for your feedback.
i will investigate, and will report to you.
Have a nice day.
Rentlau_64
cflin
Posts: 56
Joined: Sun May 14, 2017 10:21 pm

Re: MACRO:Work Feature 2014_12

Post by cflin »

Hi all,

Since I am new to the FreeCAD forums, I am not sure I am doing this correctly. I do not want to respond to any posting; I want to initiate a new one, but I see only one button, "Post Respond."

Anyway, my question is how to increase the decimal precision of the WorkFeature output. For example, when I measure a radius, WorkFeature gives me only two decimal digits of precision and if I set four digits in the general FC preferences, WorkFeature just pads the extra digits with zeroes.

See attached file. The object "Circle" is the circular opening of the head of the bolt, where the Allen wrench would be inserted. I measured its diameter with the diameter dimensioning tool of the Draft workbench (I should have probably pressed SHIFT to get the radius instead) and that measurement agrees with the radius measured in the sketcher (which contains its own circle). However, when I compare the two, WF gives me only two decimal digits, which I can verify through the Python console (copying and pasting from the Python console—observe the number-formatting string):

---------------SNIP---------------
>>> print('The radius read by WF is %1.5f mm, while Draft diameter gives %s' % (App.ActiveDocument.Circle.Radius, App.ActiveDocument.Dimension.Distance) )
The radius read by WF is 1.15000 mm, while Draft diameter gives 2.29136 mm
--------------END SNIP----------

As you can see, the diameter measured with the Draft dimensioning tool is a bit less than twice the radius measured with the WF tool.
Attachments
bolt.fcstd
(17.13 KiB) Downloaded 80 times
mario52
Veteran
Posts: 4673
Joined: Wed May 16, 2012 2:13 pm

Re: MACRO:Work Feature 2014_12

Post by mario52 »

hi
the exact radius give by WF 2017-02-05 is (and other tools)

Radius :
Object : Part__Feature.Edge30
Radius is 1.14567944036
Radius :
Object : Part__Feature.Edge30
Radius is 1.14567944036
radius00.png
radius00.png (19.95 KiB) Viewed 3360 times
(see Measure Radius)

Code: Select all

import Part
s=Gui.Selection.getSelectionEx()[0]
e=s.SubObjects[0]

if issubclass(type(e),Part.Edge):
  if issubclass(type(e.Curve),Part.Circle):
    print e.Curve.Radius
#    print e.Curve.Center
  elif issubclass(type(e.Curve),Part.ArcOfCircle):
    print e.Curve.Radius
#    print e.Curve.Center
the difference with Draft dimensioning tool is maybe the snap

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6706 (Git)
Build type: Release
Branch: releases/FreeCAD-0-16
Hash: f86a4e411ff7848dea98d7242f43b7774bee8fa0
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
User avatar
bill
Posts: 376
Joined: Fri Jan 09, 2015 9:25 pm

Re: MACRO:Work Feature 2014_12

Post by bill »

Bonjour rentlau!

I have a small request: If you are still maintaining WF, would you ADD a dimension(s) option (like: ☐ Vol.) to your bounding boxes? This will save a trip to WF:Check:Length!

See how handy it is in PATH workbench (lower picture) !

WF_BB_Dims(Option).png
WF_BB_Dims(Option).png (74.61 KiB) Viewed 3220 times
PathDimmedBB.png
PathDimmedBB.png (47.53 KiB) Viewed 3220 times
mario52
Veteran
Posts: 4673
Joined: Wed May 16, 2012 2:13 pm

Re: MACRO:Work Feature 2014_12

Post by mario52 »

hi bill

i have upgrade the macro Macro_BoundingBox_Tracing with option text (annotation) you can modify the option in the section configuration lines 31 to 49, i have add contener and name label for recognize and clarify the new object in comboView

Image

for adding this new options in the Macro WorkFeature you must wait rentlau

(if you have other idea ...)

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
User avatar
bill
Posts: 376
Joined: Fri Jan 09, 2015 9:25 pm

Re: MACRO:Work Feature 2014_12

Post by bill »

Excellent!!! Thanks mario; this will work just fine!
lboc
Posts: 4
Joined: Wed Apr 17, 2019 8:53 pm

Re: MACRO:Work Feature 2014_12

Post by lboc »

Hi, I can't seem to make this plugin work properly. If you have multiple levels of parts with where each part is rotated , the align view does not really work well.
Thanks, Lars
Post Reply