Example #1
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);

# 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
Example #2
0
    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'"