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); # 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
from pygem_quartz import gem # allow printing of entire arrays numpy.set_printoptions(threshold=100) # initialize the context, load the model, and get the first BRep myContext = gem.initialize() myModel = gem.loadModel(myContext, "sample.csm") foo = gem.getModel(myModel) myBRep = foo[4][0] # plot initial configuration print "plotting initial configuration..." myDRep = gem.newDRep(myModel) gem.tesselDRep(myDRep, 0, 0, 0, 0) gem.plotDRep(myDRep); gem.destroyDRep(myDRep) # "optimization" loop to vary "ymax" to drive the "volume" to a specified value volume_target = 15 dvoldymax = 8 for iter in range(100): print "---------------------" print "iter =", iter # get current design variable foo = gem.getParam(myModel, 4) ymax = foo[3][0] print "ymax =", ymax