Search found 2744 matches

Go to advanced search

by looo
Wed Nov 18, 2015 11:22 am
Forum: Python scripting and macros
Topic: Why doesn't freecad modules look like normal python modules?
Replies: 26
Views: 4264

Re: Why doesn't freecad modules look like normal python modules?

is it possible to make a import(MyModule) which loads __init__ without it loading the heavy libraries Python only import the __init__.py file. How much of your library is imported is dependent on the content of the __init__.py file. So for sure it is possible to specify which things should be loade...
by looo
Wed Nov 18, 2015 10:31 am
Forum: Python scripting and macros
Topic: Why doesn't freecad modules look like normal python modules?
Replies: 26
Views: 4264

Re: Why doesn't freecad modules look like normal python modules?

FreeCAD modules are not python modules. Different things. What is the difference? For me a freecad-module written in python is a python-module which has dependencies on FreeCAD and optionally on FreeCADGui. A "import FreeCAD" and a "import FreeCADGui" will be enough to state that this modules are u...
by looo
Tue Nov 17, 2015 11:22 pm
Forum: Python scripting and macros
Topic: Why doesn't freecad modules look like normal python modules?
Replies: 26
Views: 4264

Why doesn't freecad modules look like normal python modules?

A very simple question: Freecad Modules look like this: my_module/InitGui.py my_module/Init.py a nomal python module has this structure: my_module/__init__.py Why does freecad not use this structure (or something similar): my_module/__init__.py (=Init.py) my_module/Gui/__init__.py (=InitGui.py) And ...
by looo
Sun Nov 15, 2015 5:18 pm
Forum: Python scripting and macros
Topic: get freecad config, outside of freecad
Replies: 2
Views: 324

Re: get freecad config, outside of freecad

Thanks, but the problem is the PYTHONPATH. I dont't think it is default to have the freecad-libs in the PYTHONPATH. But I have found another solution: import subprocess import tempfile from distutils.core import setup with open( tempfile.gettempdir() + "/get_freecad_app_data.py", "w") as fp: fp.writ...
by looo
Sun Nov 15, 2015 3:51 pm
Forum: Python scripting and macros
Topic: get freecad config, outside of freecad
Replies: 2
Views: 324

get freecad config, outside of freecad

I want to make a workbench directly installable via pip. Therefore I need to know the location of the UserAppData. I need something similar to "freecad --get-config UserAppData" but without GUI. is this already possible?
by looo
Fri Nov 13, 2015 11:48 pm
Forum: Python scripting and macros
Topic: coin.SoFieldSensor
Replies: 18
Views: 2218

Re: coin.SoFieldSensor

I have tested this fixes with a copy repository of pivy . With this fix I get no crash for the testcase from miguel, but the pivy/coin-tests give some errors. OT: This copy of pivy is also python3 compatible, but still has some problems with the last test. https://travis-ci.org/looooo/pivy/jobs/9102...
by looo
Wed Nov 04, 2015 3:02 pm
Forum: Python scripting and macros
Topic: __setstate__ does not set attributes
Replies: 2
Views: 343

Re: __setstate__ does not set attributes

Thanks, I tried this and it works but the solution doesn't look very good. The properties get lost somehow. So I had to add them again. def __getstate__(self): out = { "glider_instance": dumps(self.obj.glider_instance), "glider_2d": dumps(self.obj.glider_2d), "name": self.obj.Name} return out def __...
by looo
Wed Nov 04, 2015 1:41 pm
Forum: Python scripting and macros
Topic: __setstate__ does not set attributes
Replies: 2
Views: 343

__setstate__ does not set attributes

I want to make a custom App::FeaturePython object serialize-able. In the code below, the properties are never set after loading a document with an object of this type. I have tried many things but couldn't make it work. So my question is: What should __setstate__ return to recreate the object? class...
by looo
Tue Oct 27, 2015 6:44 pm
Forum: Wiki
Topic: FCGear
Replies: 28
Views: 5124

Re: FCGear

thanks for the wiki entries. I will change the directory structure of the master-branch. There is also a branch which provides a pip installable version. (pip install freecad_gear). For me this is the better solution to integrate this into freecad, as it can be used also as a pure python-package out...
by looo
Mon Oct 26, 2015 12:01 pm
Forum: Wiki
Topic: FCGear
Replies: 28
Views: 5124

Re: FCGear

if you give me permission, I add a link to the wiki, where there are other "Additional modules and related projects".
Also, it would be useful a presentation page.
Feel free to add this information.

Go to advanced search