Esempio n. 1
0
    def test_LoadModel(self):
        myContext = gem.initialize()
        gem.setAttribute(myContext, "CONTEXT", 0, "Modeler", "OpenCASCADE")
        myModel = gem.loadModel(myContext, sample_file)

        gem.setAttribute(myModel, "MODEL", 0, "s_attr", "model attribute")
        gem.setAttribute(myModel, "MODEL", 0, "i_attrs", (2222222, 3333333, 4444444, 5555555))
        gem.setAttribute(myModel, "MODEL", 0, "r_attrs", (0.2345678901234567, 0.3456789012345678))

        copyModel = gem.copyModel(myModel)
        gem.releaseModel(myModel)

        server, filename, modeler, uptodate, myBReps, nparam, nbranch, nattr = gem.getModel(copyModel)
        self.assertEqual(filename, sample_file)
        self.assertEqual(modeler, "OpenCASCADE")
        self.assertEqual(uptodate, -1)
        self.assertEqual(nattr, 3)

        aname, values = gem.getAttribute(copyModel, "MODEL", 0, 1)
        self.assertEqual(aname, "s_attr")
        self.assertEqual(values, "model attribute")

        aname, values = gem.getAttribute(copyModel, "MODEL", 0, 2)
        self.assertEqual(aname, "i_attrs")
        self.assertEqual(values[0], 2222222)
        self.assertEqual(values[1], 3333333)
        self.assertEqual(values[2], 4444444)
        self.assertEqual(values[3], 5555555)

        aname, values = gem.getAttribute(copyModel, "MODEL", 0, 3)
        self.assertEqual(aname, "r_attrs")
        self.assertEqual(values[0], 0.2345678901234567)
        self.assertEqual(values[1], 0.3456789012345678)

        gem.releaseModel(copyModel)
        gem.terminate(myContext)
Esempio n. 2
0
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
nbranch  = foo[6]                                 ;print "nbranch        ->", nbranch
nattr    = foo[7]

gem.setAttribute(myBReps[0], "BREP", 0, "s_attr", "brep attribute")
gem.setAttribute(myBReps[0], "BREP", 0, "i_attrs", (0, 1, 2, 3, 4, 5))
gem.setAttribute(myBReps[0], "BREP", 0, "r_attrs", (0., 0.1, 0.2, 0.3, 0.4, 0.5))

# get information about each of the Attributes
for iattr in range(1, nattr+1):
    dum    = 0                                    ;print "iattr          ->", iattr
    foo    = gem.getAttribute(myModel, "MODEL", 0, iattr)
    aname  = foo[0]                               ;print ".  aname       ->", aname
    values = foo[1]                               ;print ".  values      ->", values

# get information about each of the Parameters
for iparam in range(1, nparam+1):
    dum    = 0                                    ;print "iparam         ->", iparam
    foo    = gem.getParam(myModel, iparam)
    pname  = foo[0]                               ;print ".  pname       ->", pname
    bflag  = foo[1]                               ;print ".  bflag       ->", bflag
    order  = foo[2]                               ;print ".  order       ->", order
    values = foo[3]                               ;print ".  values      ->", values
    nattr  = foo[4]

    for iattr in range(1, nattr+1):
        dum    = 0                                ;print ".  iattr       ->", iattr