for iattr in range(1, nattr+1): dum = 0 ;print ". . iattr ->", iattr foo = gem.getAttribute(myBRep, "SHELL", ishell, iattr) aname = foo[0] ;print ". . . aname ->", aname values = foo[1] ;print ". . . values->", values foo = gem.getMassProps(myBRep, "SHELL", ishell) area = foo[ 1] ;print ". . area ->", area # set up a DRep for myModel myDRep = gem.newDRep(myModel) ;print "myDRep ->", myDRep maxang = 0; maxlen = 0; maxsag = 0; gem.tesselDRep(myDRep, 0, maxang, maxlen, maxsag); # get tessellation associated with the first Face of each DRep 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);
print "volume=", volume # if we have converged, stop the iterations if (abs(volume-volume_target) < 0.001): break # change the box height and regenerate the model ymax = ymax + (volume_target - volume) / dvoldymax print "ymax =", ymax gem.setParam(myModel, 4, (ymax,)) gem.regenModel(myModel) # print and plot "final" configuration print "*******************************" print "final ymax =", ymax print "target volume =", volume_target print "final volume =", volume print "differ volume =", volume-volume_target print "plotting final configuration..." myDRep = gem.newDRep(myModel) gem.tesselDRep(myDRep, 0, 0, 0, 0) gem.plotDRep(myDRep); gem.destroyDRep(myDRep) # release the Model and terminate gem.releaseModel(myModel) gem.terminate(myContext) print "SUCCESSFUL completion of 'opt_gem.py'"