From 49b5f5d90add389eee53f73a87079efafb23abe5 Mon Sep 17 00:00:00 2001 From: microelly2 Date: Mon, 27 Apr 2015 20:28:04 +0200 Subject: [PATCH] demo macro myMacroDir for naming conventions --- myMacroDir/__init__.py | 1 + myMacroDir/myMacro.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 myMacroDir/__init__.py create mode 100644 myMacroDir/myMacro.py diff --git a/myMacroDir/__init__.py b/myMacroDir/__init__.py new file mode 100644 index 0000000..40767be --- /dev/null +++ b/myMacroDir/__init__.py @@ -0,0 +1 @@ +import myMacro diff --git a/myMacroDir/myMacro.py b/myMacroDir/myMacro.py new file mode 100644 index 0000000..69889b9 --- /dev/null +++ b/myMacroDir/myMacro.py @@ -0,0 +1,31 @@ +# +# your copyright info here +# + +import FreeCAD + + +# +# the macro should have a test method to check the sucess of the installation +# +def test(): + errorMsg="There are some errors: a, b, c" + warnMsg="There are some warnings: d, e" + infoMsg="There is a info: f" + errors=3 + warns=2 + infos=1 + result=[errors,errorMsg,warns,warnMsg,infos,infoMsg] + return result + +# +# the macro should have a main method - the macro itself +# +def main(): + t=FreeCAD.ParamGet('User parameter:BaseApp/Preferences/Macro') + mp=t.GetString("MacroPath") + FreeCAD.Console.PrintMessage("\n"*4+"H E L L O W O R L D,\n I'm myMacro.py located in "+ mp+ "/MyMacroDir" + "\n"*4) + + + +