Hi Henrik, I got your patch to OCCViewer.py. You don't necessarily have to modifiy the OCCViewer.py script in order to add features. You can do it from any other python script : the Viewer3d class comes with a few properties (Context_handle, Viewer_handle, Context, Viewer, View) that you can access outside this class, and do whatever you want with graphic stuff.
I don't really know if creating a list (or dict) of displayed shapes is the best way to one shape erased from the viewer. In the past (well, maybe 6 months ago), I had such a list as a property of the OCCViewer class, and decided to remove it. But why not create an AdvancedOCCViewer class, that inherits from OCCViewer, and provide additional and/or experimental features. Thomas 2010/2/16 Henrik Rudstrom <hrudst...@googlemail.com> > Hi there, > I dont know how to update a shape in the viewer. > As far as i know there is no EraseShape function, so i added one (dont know > if Thomas has/will? added it to the svn, so see attachment). > To use it, got to ..../site-packages/OCC/Display and backup OCCViewer.py > and add the patched one. Hopefully you can now do > display.EraseShape(someshape). Is a slightly quick and dirty fix, so cannot > guarantee anything though. > > > > Henrik Rudstrom > > > > On 16 February 2010 18:16, Willy Hertz <willy.he...@yahoo.com> wrote: > >> hi all, >> i am pythonocc newbie, and my question may seem stupid. >> >> i try to modify a shape in the InteractiveVeiwer example from the >> pythonocc samples, after it has been displayed using >> display.DisplayShape(shape). >> the following code creates four edges of a rectangle in the plane z=0, and >> one of the edges should be translated to z=10: >> >> p1=gp_Pnt(0,0,0); >> p2=gp_Pnt(0,1,0); >> p3=gp_Pnt(1,1,0); >> p4=gp_Pnt(1,0,0); >> e1=BRepBuilderAPI_MakeEdge(p1,p2).Edge() >> e2=BRepBuilderAPI_MakeEdge(p2,p3).Edge() >> e3=BRepBuilderAPI_MakeEdge(p3,p4).Edge() >> e4=BRepBuilderAPI_MakeEdge(p4,p1).Edge() >> trsf=gp_Trsf(); >> trsf.SetTranslation(gp_Vec(0,0,10)); >> display.DisplayShape(e1); >> display.DisplayShape(e2); >> display.DisplayShape(e3); >> display.DisplayShape(e4); >> e1.Move(TopLoc_Location(trsf)); >> >> this works like a charm, if i put the e1.Move(...) command before the >> display.DisplayShape(...) commands. but not in the order above. >> >> how can i modify what is displayed, after a shape has already been >> displayed? >> >> do i have to remove the modified shape, remove it from the display, and >> create+display the modified shape again? then please tell me how to remove a >> shape from the display. GraphicsCanva3D has the DisplayShape() function, but >> except for EraseAll() there is no function to remove a singe shape? >> >> when answering please consider that i don't understand the pythonocc >> concepts in great detail. please assume that i am as stupid as my question >> ;) >> >> Willy >> >> >> _______________________________________________ >> Pythonocc-users mailing list >> Pythonocc-users@gna.org >> https://mail.gna.org/listinfo/pythonocc-users >> >> > > _______________________________________________ > Pythonocc-users mailing list > Pythonocc-users@gna.org > https://mail.gna.org/listinfo/pythonocc-users > >
_______________________________________________ Pythonocc-users mailing list Pythonocc-users@gna.org https://mail.gna.org/listinfo/pythonocc-users