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!
mario52
Veteran
Posts: 4692
Joined: Wed May 16, 2012 2:13 pm

Re: MACRO:Work Feature 2014_12

Post by mario52 »

hi lboc
lboc wrote: Tue Nov 12, 2019 11:25 am If you have multiple levels of parts with where each part is rotated , the align view does not really work well.
more explanation , tools used, screenshot ...

thanks

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.
cram
Posts: 228
Joined: Mon Dec 05, 2016 5:11 am
Location: Australia

Re: MACRO:Work Feature 2014_12

Post by cram »

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.4 (GitTag)
Build type: Release
Branch: releases/FreeCAD-0-18
Hash: 980bf9060e28555fecd9e3462f68ca74007b70f8
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Australia (en_AU)


Hi, I just tried to install this macro, there appears to be two listed in the freecad addon repository one named "workfeature" and another name "workfeature-macro" . "workfeature" doesn't seem to have the amount of function as has been described earlier in this thread, so uninstalled it. Attempted to install "workfeature-macro" but it doesn't appear to complete install, however states installed under the addon repository but does not show up in the workbenches. Any suggestions?
mario52
Veteran
Posts: 4692
Joined: Wed May 16, 2012 2:13 pm

Re: MACRO:Work Feature 2014_12

Post by mario52 »

hi

"workfeature-macro" is a macro and not a workbench (contrary to "workfeature") you must run the macro "start_WF.py" (or start_WF.FCMacro) in :

Code: Select all

C:\Users\Mario\AppData\Roaming\FreeCAD\Mod\WorkFeature\
or if the macro in helpfull fot you (as my) you must modify the property of the FreeCAD shortcut as this command line:

Code: Select all

"C:\Your FreeCAD name\bin\FreeCAD.exe" "C:\Users\UserName\AppData\Roaming\FreeCAD\Mod\WorkFeature\start_WF.FCMacro"
(correct the path if the macro is installed in other directory)

try this and report please

PS: the new "workfeature" workbench (same feature of the macro in the future) is still in development by rentlau_64 but personally i prefer the macro she is always available and not the workbench

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.
cram
Posts: 228
Joined: Mon Dec 05, 2016 5:11 am
Location: Australia

Re: MACRO:Work Feature 2014_12

Post by cram »

mario52 wrote: Fri Dec 06, 2019 11:06 am hi

"workfeature-macro" is a macro and not a workbench (contrary to "workfeature") you must run the macro "start_WF.py" (or start_WF.FCMacro) in :

Code: Select all

C:\Users\Mario\AppData\Roaming\FreeCAD\Mod\WorkFeature\
or if the macro in helpfull fot you (as my) you must modify the property of the FreeCAD shortcut as this command line:

Code: Select all

"C:\Your FreeCAD name\bin\FreeCAD.exe" "C:\Users\UserName\AppData\Roaming\FreeCAD\Mod\WorkFeature\start_WF.FCMacro"
(correct the path if the macro is installed in other directory)

try this and report please

PS: the new "workfeature" workbench (same feature of the macro in the future) is still in development by rentlau_64 but personally i prefer the macro she is always available and not the workbench

mario
Thanks Mario, my install of freecad was not pointing to the correct directory for the macro, and yes I was expecting it to be a workbench. I have found it and able to launch, haven't yet tried to use the fuctions of workfeatures yet. What is the difference between WF.FCMacro and start_WF.py ?
mario52
Veteran
Posts: 4692
Joined: Wed May 16, 2012 2:13 pm

Re: MACRO:Work Feature 2014_12

Post by mario52 »

hi

good
cram wrote: Sat Dec 07, 2019 12:55 pm What is the difference between WF.FCMacro and start_WF.py ?
for the code any difference same code

start_WF.FCMacro run as a macro FreeCAD

and start_WF.py with the interpreter Python

Code: Select all

import start_WF
from importlib import reload
reload(start_WF)
enjoy

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.
cram
Posts: 228
Joined: Mon Dec 05, 2016 5:11 am
Location: Australia

Re: MACRO:Work Feature 2014_12

Post by cram »

mario52 wrote: Sat Dec 07, 2019 4:30 pm hi

good
cram wrote: Sat Dec 07, 2019 12:55 pm What is the difference between WF.FCMacro and start_WF.py ?
for the code any difference same code

start_WF.FCMacro run as a macro FreeCAD

and start_WF.py with the interpreter Python

Code: Select all

import start_WF
from importlib import reload
reload(start_WF)
enjoy

mario
Cheers Mario, thank you, I now understand.
manos
Posts: 432
Joined: Thu Nov 12, 2020 10:48 am
Location: Greece

Re: MACRO:Work Feature 2014_12

Post by manos »

rentlaw_64 congratulations for the Workfeature macro.
I use it some time ago but I think there is a bug at selection Check--> "Coplanar?" of the macro.
I select the Datum Plane DatumPlane001 and the green face of the Pocket001 .
Then I select Check -->Coplanar? and the answer is Yes.
This answer is obviously wrong. What is happening ?

OS: Ubuntu 18.04.5 LTS (ubuntu:GNOME/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24276 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0.19.1)
Hash: a88db11e0a908f6e38f92bfc5187b13ebe470438
Python version: 3.8.8
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United States (en_US)
Attachments
Basic Attachment Tutorial 1.FCStd
(28.12 KiB) Downloaded 49 times
mario52
Veteran
Posts: 4692
Joined: Wed May 16, 2012 2:13 pm

Re: MACRO:Work Feature 2014_12

Post by mario52 »

hi

the code is here : MACRO:Work Feature 2014_12
rentlaw_64 wrote:ping
(split)

Code: Select all

SelObj = Gui.Selection.getSelectionEx()
tolerance  = 1e-10

NormalA = SelObj[0].SubObjects[0].normalAt(0,0)
VAB = (SelObj[1].SubObjects[0].CenterOfMass-SelObj[0].SubObjects[0].CenterOfMass).normalize()
if NormalA.dot(VAB) == 0.0:
    FreeCAD.Console.PrintMessage("\nCoplanar faces\n")
else:
    FreeCAD.Console.PrintMessage("\nNon coplanar faces\n")


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.
manos
Posts: 432
Joined: Thu Nov 12, 2020 10:48 am
Location: Greece

Re: MACRO:Work Feature 2014_12

Post by manos »

mario52 thank you so much for the code snippet.
Unfortunately I do not know how to use it at the FC environment.
mario52
Veteran
Posts: 4692
Joined: Wed May 16, 2012 2:13 pm

Re: MACRO:Work Feature 2014_12

Post by mario52 »

hi

select your faces paste the code in FreeCAD Python console

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.
Post Reply