Hi, I'm having trouble getting pythonOCC's 2D viewer to display shapes. I'm using the wxSamplesGui2D.py file in the Display directory to test. I'm trying to run the "sphere" or "cube" pull-down menu options. It didn't work. I tried to fix it. First, I had to make a number of file modifications. Here's what I did:
In Display/wxSamplesGui2D.py: 1. Change the "display2d" variable name to "display" 2. Change the "start_display2d()" function name to "StartDisplay" In Display/wxDisplay.py: 1. In the wxViewer2d.InitDriver() method, change the line from: "self._display.Create()" to "self._display.Create(False)" Even then, I get a TypeError in OCCViewer.py. It seems to me the "shape_to_display" should not be an AIS_Shape, but an AIS2D_ProjShape. I made the following substitutions in OCCViewer.py: 1. In the Viewer2d.DisplayShape() method, right after the "else:", remove the line "shape_to_display = OCC.AIS.AIS_Shape(shape)" and add the following lines: proj = OCC.HLRAlgo.HLRAlgo_Projector(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1), gp_Dir(1, 0, 0))) # gp_Ax2 is temporary place-holder shape_to_display = OCC.AIS2D.AIS2D_ProjShape(proj, 0, 0, 0) shape_to_display.ShowEdges(1, 0, 0, 1, 0) shape_to_display.Add(shape) (I obviously had to import a few more modules too.) However, this caused a segmentation fault. At this point, it got beyond my debug capabilities. Furthermore, it seemed unlikely to me that so many file modifications are necessary. I'm concerned I'm missing something obvious. I'm using pythonOCC 0.5; however, a quick perusal of the latest/greatest source didn't reveal any changes to the files in these areas. I have the following questions: 1. Does the wxSamplesGui2D.py example work for anyone else? If so, can you help me identify what I'm doing wrong? 2. If it doesn't work, and my changes are on the right track, can you confirm the segmentation fault and recommend a fix for it? If you want me to post/email my files, let me know. If you're interested in the application, I'm trying to write a patent, and I used pythonOCC to model my invention. I was hoping to create line drawings from pythonOCC for the patent. They look fine in DRAWEXE: "pload ALL; restore shape.brep s1; v2dinit; hlrtest s1" but they require a number of changes and edits from this simple script and a pipe through the Python Imaging Library. I don't know tcl, so I'd prefer a pure python route. Using the "HLR" option in pythonOCC's 3D SimpleGUI didn't create a "drafting-type" drawing, but the AIS2D_ProjShape class (called by "hlrtest") does. Thanks in advance, Charles _______________________________________________ Pythonocc-users mailing list Pythonocc-users@gna.org https://mail.gna.org/listinfo/pythonocc-users