Search found 7 matches

by RafaelRS
Mon Oct 28, 2019 8:21 pm
Forum: Python scripting and macros
Topic: Scripted object doesn't reopens after document closure
Replies: 7
Views: 1011

Re: Scripted object doesn't reopens after document closure

Thanks, microelly2, for your answers, but i didn't fully understood what you said. However, i've found good fast solution. 1. As you said, move creation inside function 2. Call function only following 'if' passed: if __name__ == "__main__": It took idea from https://github.com/ncsaba/freec...
by RafaelRS
Thu Oct 24, 2019 11:19 am
Forum: Python scripting and macros
Topic: Scripted object doesn't reopens after document closure
Replies: 7
Views: 1011

Re: Scripted object doesn't reopens after document closure

Ok, i found reason. Executable bit should be set for LProfile.py. Now i see another problem. When i start FreeCAD and then open my file, addtional LProfile object was created and there some errors: ksnip_20191024-141448.png Now, if i close document and open it again it will be OK. I think that durin...
by RafaelRS
Thu Oct 24, 2019 11:00 am
Forum: Python scripting and macros
Topic: Scripted object doesn't reopens after document closure
Replies: 7
Views: 1011

Re: Scripted object doesn't reopens after document closure

The macro file must exists in a directory which is coverd by the sys.path list. only in this case the classes can be loaded on demand and applied to the object. Well, print(sys.path) gives me: ['/tmp/.mount_FreeCAWmqUwV/usr/lib/python3.7/site-packages/git/ext/gitdb' '/home/rafaelrs/.FreeCAD/Mod/BIM...
by RafaelRS
Thu Oct 24, 2019 10:07 am
Forum: Python scripting and macros
Topic: Scripted object doesn't reopens after document closure
Replies: 7
Views: 1011

Re: Scripted object doesn't reopens after document closure

I solved issue by typing in console: >>> from LProfile import LProfile >>> from LProfile import ViewProviderLProfile That thing wasn't mentioned in documentation: https://www.freecadweb.org/wiki/Manual:Creating_parametric_objects Stills feeling, that this action shouldn't be required and i missed so...
by RafaelRS
Thu Oct 24, 2019 9:04 am
Forum: Python scripting and macros
Topic: Scripted object doesn't reopens after document closure
Replies: 7
Views: 1011

Re: Scripted object doesn't reopens after document closure

I tested same on newly installed FreeCAD 0.16 on Centos 7, same result: <unknown exception traceback><type 'exceptions.AttributeError'>: 'module' object has no attribute 'LProfile' <unknown exception traceback><type 'exceptions.AttributeError'>: 'module' object has no attribute 'ViewProviderLProfile'
by RafaelRS
Thu Oct 24, 2019 7:54 am
Forum: Python scripting and macros
Topic: Scripted object doesn't reopens after document closure
Replies: 7
Views: 1011

Scripted object doesn't reopens after document closure

I have following macro: class LProfile: def __init__(self,obj): obj.Proxy = self obj.addProperty("App::PropertyLength","Length","Profile") obj.addProperty("App::PropertyLength","Side1Width","Profile") obj.addProperty("App::PropertyLeng...
by RafaelRS
Tue Sep 17, 2019 7:42 am
Forum: Open discussion
Topic: Feature Request: default file type when export
Replies: 5
Views: 689

Feature Request: default file type when export

Currently when you do export (and i am doing it to STL) it always offer first to export to AMF type. So i have every time to scroll file types to select STL. That's annoying when you do it several times: - export - open in Cura to print or find corrections to do - correct in FreeCAD - export again a...