Hi Strrange: the two backtraces are very different, whereas the python scripts > are quite similar. I will investigate this further in the begining of the > next week. I just >
The main difference between the two scripts attached before is the order of the calls: in PAF1.py, I add parameters height and radius to p before I create the context, and in PAF2.py it is the other way around. Note that in PAF1.py python segfaults when creating the cylinder while in PAF2.py it crashes when I quit python. I would like also to bring you attention on the strange message sent by python when creating p.height and p.radius (see PAF1.log). Talking about this, there aren't such message in PAF2.log which means that the order might be at stack. > have another question: do the samples in the /src/samples/Level2/PAF work > or do they also segfault? > They also segfaults when I close the 3D viewer this time. Also, a difference that could make sens for you, In those examples I can interact with the 3D viewer (rotate, ... even the zoom window works). While in PAF2.py, the viewer seems freezed, I can't even close it (thats why I have to call quit() ). I hope we can figure this out, but right now I'm just going to sleep. See you, Loïc
In [1]: from OCC.PAF.Context import ParametricModelingContext In [2]: from OCC.PAF.Parametric import Parameters In [3]: In [4]: p = Parameters() In [5]: In [6]: p.height = 43.3 Parameter height created --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /home/matador/Desktop/Code/pythonOCC/<ipython console> in <module>() /usr/local/lib/python2.6/dist-packages/OCC/PAF/Parametric.pyc in __setattr__(self, name, value) 213 214 # add the parameter to the Interpreter ( which does the real work ) --> 215 self.context.set_parameter(name,value, self._commit) 216 217 def __getattribute__(self, name): /usr/local/lib/python2.6/dist-packages/OCC/PAF/Parametric.pyc in __getattribute__(self, name) 216 217 def __getattribute__(self, name): --> 218 attr = object.__getattribute__(self, name) 219 if isinstance(attr, int) or isinstance(attr, float): 220 try: AttributeError: 'Parameters' object has no attribute 'context' In [7]: p.radius = 12.9 Parameter radius created --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /home/matador/Desktop/Code/pythonOCC/<ipython console> in <module>() /usr/local/lib/python2.6/dist-packages/OCC/PAF/Parametric.pyc in __setattr__(self, name, value) 213 214 # add the parameter to the Interpreter ( which does the real work ) --> 215 self.context.set_parameter(name,value, self._commit) 216 217 def __getattribute__(self, name): /usr/local/lib/python2.6/dist-packages/OCC/PAF/Parametric.pyc in __getattribute__(self, name) 216 217 def __getattribute__(self, name): --> 218 attr = object.__getattribute__(self, name) 219 if isinstance(attr, int) or isinstance(attr, float): 220 try: AttributeError: 'Parameters' object has no attribute 'context' In [8]: tutorial_context = ParametricModelingContext(p) MSG:./src/GEOMImpl/GEOMImpl_IShapesOperations.cpp [142] : GEOMImpl_IShapesOperations::GEOMImpl_IShapesOperations ParametricModelingContext initialized In [9]: tutorial_context.init_display() Xlib: extension "Generic Event Extension" missing on display ":1000.0". Xlib: extension "Generic Event Extension" missing on display ":1000.0". Xlib: extension "Generic Event Extension" missing on display ":1000.0". Xlib: extension "Generic Event Extension" missing on display ":1000.0". Xlib: extension "Generic Event Extension" missing on display ":1000.0". Display3d class initialization starting ... Xlib: extension "Generic Event Extension" missing on display ":1000.0". Graphic device created. Xw_Window created. Viewer created. Interactive context created. Display3d class successfully initialized. Display initialized In [10]: tutorial_context.register_operations(tutorial_context.prim_operations) In [11]: my_cylinder = tutorial_context.prim_operations.MakeCylinderRH(p.radius,p.height,name="cylinder1", show=True) parameter: radius value: 12.9 parameter: height value: 43.3 got *args: (<OCC.PAF.Context.prim_operations object at 0x387e510>, <OCC.PAF.Parametric.Parameter; proxy of <Swig Object of type 'GEOM_Parameter *' at 0x45e4b70> >, <OCC.PAF.Parametric.Parameter; proxy of <Swig Object of type 'GEOM_Parameter *' at 0x45e4b40> >) modified args: (<OCC.PAF.Parametric.Parameter; proxy of <Swig Object of type 'GEOM_Parameter *' at 0x45e4b70> >, <OCC.PAF.Parametric.Parameter; proxy of <Swig Object of type 'GEOM_Parameter *' at 0x45e4b40> >) got **kwargs: {'name': 'cylinder1', 'show': True} initialized context with <class 'OCC.GEOMImpl.GEOMImpl_I3DPrimOperations'> start operation zsh: segmentation fault ipython
In [1]: from OCC.PAF.Context import ParametricModelingContext In [2]: from OCC.PAF.Parametric import Parameters In [3]: from OCC.PAF.Parametric import Relation In [4]: from OCC.PAF.Parametric import Rule In [5]: In [6]: p = Parameters() In [7]: In [8]: tutorial_context = ParametricModelingContext(p) MSG:./src/GEOMImpl/GEOMImpl_IShapesOperations.cpp [142] : GEOMImpl_IShapesOperations::GEOMImpl_IShapesOperations ParametricModelingContext initialized In [9]: tutorial_context.init_display() Xlib: extension "Generic Event Extension" missing on display ":1000.0". Xlib: extension "Generic Event Extension" missing on display ":1000.0". Xlib: extension "Generic Event Extension" missing on display ":1000.0". Xlib: extension "Generic Event Extension" missing on display ":1000.0". Xlib: extension "Generic Event Extension" missing on display ":1000.0". Display3d class initialization starting ... Xlib: extension "Generic Event Extension" missing on display ":1000.0". Graphic device created. Xw_Window created. Viewer created. Interactive context created. Display3d class successfully initialized. Display initialized In [10]: In [11]: p.height = 43.3 Parameter height created parameter: _commit value: False In [12]: p.radius = 12.9 Parameter radius created parameter: _commit value: False In [13]: In [14]: tutorial_context.register_operations(tutorial_context.prim_operations) In [15]: my_cylinder = tutorial_context.prim_operations.MakeCylinderRH(p.radius,p.height,name="cylinder1", show=True) parameter: radius value: 12.9 parameter: height value: 43.3 got *args: (<OCC.PAF.Context.prim_operations object at 0x43f5c50>, <OCC.PAF.Parametric.Parameter; proxy of <Swig Object of type 'GEOM_Parameter *' at 0x51646f0> >, <OCC.PAF.Parametric.Parameter; proxy of <Swig Object of type 'GEOM_Parameter *' at 0x51646c0> >) modified args: (<OCC.PAF.Parametric.Parameter; proxy of <Swig Object of type 'GEOM_Parameter *' at 0x51646f0> >, <OCC.PAF.Parametric.Parameter; proxy of <Swig Object of type 'GEOM_Parameter *' at 0x51646c0> >) got **kwargs: {'name': 'cylinder1', 'show': True} initialized context with <class 'OCC.GEOMImpl.GEOMImpl_I3DPrimOperations'> start operation result: <OCC.SGEOM.Handle_GEOM_Object; proxy of <Swig Object of type 'Handle_GEOM_Object *' at 0x5164720> > finish operation set object name: cylinder1 In [16]: In [17]: radius = p.radius.symbol parameter: radius value: 12.9 In [18]: height = p.height.symbol parameter: height value: 43.3 In [19]: In [20]: Rel = 2*radius In [21]: Relation(p,"height",Rel) Callback added Out[21]: <OCC.PAF.Parametric.Relation object at 0x51627d0> In [22]: In [23]: def IsPositive(x): ....: return x>0 ....: In [24]: Rule(p,"radius",IsPositive) Out[24]: <OCC.PAF.Parametric.Rule object at 0x5162810> In [25]: quit() Do you really want to exit ([y]/n)? zsh: segmentation fault ipython
_______________________________________________ Pythonocc-users mailing list Pythonocc-users@gna.org https://mail.gna.org/listinfo/pythonocc-users