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

# 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