def test_DRep(self): myContext = gem.initialize() gem.setAttribute(myContext, "CONTEXT", 0, "Modeler", "OpenCASCADE") myModel = gem.loadModel(myContext, sample_file) myDRep = gem.newDRep(myModel) gem.tesselDRep(myDRep, 0, 0, 0, 0) iface = 1 triArray, xyzArray = gem.getTessel(myDRep, 1, 1) npnt = (xyzArray.shape)[0] ntri = (triArray.shape)[0] # make sure that triangle pointers are consistent for itri in range(1, ntri + 1): for iside in [0, 1, 2]: jtri = triArray[itri - 1, iside] if not ((jtri > 0) and (jtri <= npnt)): self.fail("jtri not in (0 to %d)" % npnt) gem.destroyDRep(myDRep) gem.releaseModel(myModel) gem.terminate(myContext)
for ibrep in range(1, len(myBReps)+1): dum = 0 ;print ". ibrep ->", ibrep iface = 1 ;print ". . iface ->", iface foo = gem.getTessel(myDRep, ibrep, iface) xyz = foo[0] ;print ". . xyz --->\n", xyz uv = foo[1] ;print ". . uv --->\n", uv conn = foo[2] ;print ". . conn --->\n", conn # plot the DRep print "plotting myDRep..." gem.plotDRep(myDRep); # destroy the DRep print "destroying myDRep" gem.destroyDRep(myDRep) # create a static model and add myBrep into it twice newModel = gem.staticModel(myContext) ;print "newModel ->", newModel print "adding myBRep to newModel twice" gem.add2Model(newModel, myBRep) gem.add2Model(newModel, myBRep, (0.5, 0, 0, 2, 0, 0.5, 0, 0, 0, 0, 0.5, 0)) foo = gem.getModel(newModel) server = foo[0] ;print "server ->", server filename = foo[1] ;print "filename ->", filename modeler = foo[2] ;print "modeler ->", modeler uptodate = foo[3] ;print "uptodate ->", uptodate myBReps = foo[4] ;print "myBReps ->", myBReps nparam = foo[5] ;print "nparam ->", nparam