예제 #1
0
 def ReadModel(self, f, options):
     (m, msg) = import_vecfile.ReadVecFileToModel(f, options)
     self.assertIsNotNone(m)
     self.assertEqual(msg, "")
     if SHOW:
         showfaces.ShowFaces(m.faces, m.points, f)
     return m
예제 #2
0
 def testBevel4pt(self):
     opt = import_vecfile.ImportOptions()
     opt.bevel_amount = .5
     opt.convert_options.filled_only = False
     opt.convert_options.smoothness = 0
     (m, msg) = import_vecfile.ReadVecFileToModel("testfiles/4pt.ai", opt)
     self.assertEqual(msg, "")
     self.assertEqual(len(m.faces), 5)
     if SHOW:
         showfaces.ShowFaces(m.faces, m.points, "Bevel 4pt")
예제 #3
0
 def testTri(self):
     pa = geom.PolyArea(
         geom.Points([(0.0, 0.0, 0.0), (1.0, 0.0, 0.0), (0.5, 0.25, 0.0)]),
         [0, 1, 2])
     o = offset.Offset(pa, 0.0, 0.0)
     o.Build()
     m = geom.Model()
     m.points = pa.points
     model.AddOffsetFacesToModel(m, o)
     if SHOW:
         showfaces.ShowFaces(m.faces, m.points, "Tri")
예제 #4
0
 def testBevel3dout(self):
     opt = import_vecfile.ImportOptions()
     opt.bevel_amount = 0.05
     opt.convert_options.filled_only = False
     opt.convert_options.smoothness = 0
     opt.convert_options.combine_paths = True
     (m, msg) = import_vecfile.ReadVecFileToModel("testfiles/3dout.ai", opt)
     self.assertEqual(msg, "")
     self.assertEqual(len(m.faces), 44)
     if SHOW:
         showfaces.ShowFaces(m.faces, m.points, "Bevel 3dout")
예제 #5
0
 def testIrreg(self):
     pa = geom.PolyArea(
         geom.Points([(0.0, 0.1, 0.0), (-0.1, -0.2, 0.0), (0.1, -0.25, 0.0),
                      (0.3, 0.05, 0.0), (1.0, 0.0, 0.0), (1.1, 1.0, 0.0),
                      (-0.1, 1.2, 0.0)]), list(range(0, 7)))
     o = offset.Offset(pa, 0.0, 0.0)
     o.Build()
     m = geom.Model()
     m.points = pa.points
     model.AddOffsetFacesToModel(m, o)
     if SHOW:
         showfaces.ShowFaces(m.faces, m.points, "Irreg")
예제 #6
0
 def testHoles(self):
     ans = triquad.QuadrangulateFaceWithHoles(F2outer, [F2hole1, F2hole2], Vs2)
     if Show:
         showfaces.ShowFaces(ans, Vs2, "F2 - quad")
예제 #7
0
 def testM(self):
     ans = triquad.QuadrangulateFace(Fsm, Vsm)
     if Show:
         showfaces.ShowFaces(ans, Vsm, "Fsm - quad")
     self.assertEqual(len(ans), 14)
예제 #8
0
 def testCircle(self):
     ans = triquad.QuadrangulateFace(F3circle, Vs3)
     if Show:
         showfaces.ShowFaces(ans, Vs3, "F3circle - quad")
     self.assertEqual(len(ans), 9)
예제 #9
0
 def testSquare(self):
     ans = triquad.QuadrangulateFace(F1square, Vs1)
     if Show:
         showfaces.ShowFaces(ans, Vs1, "F1square - quad")
     self.assertEqual(len(ans), 1)
예제 #10
0
 def testTriangle(self):
     ans = triquad.QuadrangulateFace(F1tri, Vs1)
     if Show:
         showfaces.ShowFaces(ans, Vs1, "F1tri - quad")
     self.assertEqual(ans, [tuple(F1tri)])
예제 #11
0
 def testM(self):
     ans = triquad.TriangulateFace(Fsm, Vsm)
     if Show:
         showfaces.ShowFaces(ans, Vsm, "Fsm - tri")
     self.assertEqual(len(ans), 26)