示例#1
0
 def bot(
     self,
     name,
     mode=3,
     orientation=1,
     flags=0,
     vertices=[[0, 0, 0], [0, 0, 1], [0, 1, 0], [1, 0, 0]],
     faces=[[0, 1, 2], [1, 2, 3], [3, 1, 0]],
     thickness=[2, 3, 1],
     face_mode=[True, True, False],
 ):
     face_mode_struct = 0
     if mode == 3:
         face_mode_struct = libbu.bu_bitv_new(len(faces))
         for i in range(len(faces)):
             if face_mode[i]:
                 cta.bit_set(face_mode_struct, i)
     libwdb.mk_bot(
         self.db_fp,
         name,
         mode,
         orientation,
         flags,
         len(vertices),
         len(faces),
         cta.doubles(vertices),
         cta.integers(faces),
         cta.doubles(thickness),
         face_mode_struct,
     )
示例#2
0
 def build_segment(self):
     result = librt.struct_nurb_seg()
     result.magic = librt.CURVE_NURB_MAGIC
     result.order = self.order
     coordinates_count = 3 if self.weights else 2
     result.pt_type = (1 if self.weights else 0) + (self.point_type << 1) + (coordinates_count << 5)
     result.c_size = len(self._points)
     result.ctl_points = cta.integers(self._points, flatten=False)
     result.weights = cta.doubles(self.weights, flatten=False)
     knots = librt.struct_knot_vector()
     knots.magic = librt.NMG_KNOT_VECTOR_MAGIC
     knots.k_size = len(self.knot_vector)
     knots.knots = cta.doubles(self.knot_vector, flatten=False)
     result.k = knots
     return result
示例#3
0
 def build_segment(self):
     result = librt.struct_nurb_seg()
     result.magic = librt.CURVE_NURB_MAGIC
     result.order = self.order
     coordinates_count = 3 if self.weights else 2
     result.pt_type = (1 if self.weights else 0) + (self.point_type << 1) + (coordinates_count << 5)
     result.c_size = len(self._points)
     result.ctl_points = cta.integers(self._points, flatten=False)
     result.weights = cta.doubles(self.weights, flatten=False)
     knots = librt.struct_knot_vector()
     knots.magic = librt.NMG_KNOT_VECTOR_MAGIC
     knots.k_size = len(self.knot_vector)
     knots.knots = cta.doubles(self.knot_vector, flatten=False)
     result.k = knots
     return result
示例#4
0
 def bot(self,
         name,
         mode=3,
         orientation=1,
         flags=0,
         vertices=[[0, 0, 0], [0, 0, 1], [0, 1, 0], [1, 0, 0]],
         faces=[[0, 1, 2], [1, 2, 3], [3, 1, 0]],
         thickness=[2, 3, 1],
         face_mode=[True, True, False]):
     face_mode_struct = 0
     if mode == 3:
         face_mode_struct = libbu.bu_bitv_new(len(faces))
         for i in range(len(faces)):
             if face_mode[i]:
                 cta.bit_set(face_mode_struct, i)
     libwdb.mk_bot(self.db_fp, name, mode,
                   orientation, flags, len(vertices), len(faces),
                   cta.doubles(vertices), cta.integers(faces),
                   cta.doubles(thickness), face_mode_struct)
示例#5
0
 def metaball(self, name, points=(((1, 1, 1), 1, 0), ((0, 0, 1), 2, 0)), threshold=1, method=2):
     """
     ctrl_points: corresponds to metaball control points
            ctrl_point = (point, field_strength, sweat)
     """
     if method < 0 or threshold <= 0:
         raise BRLCADException("Invalid Arguments")
     m = cta.brlcad_new(libwdb.struct_rt_metaball_internal)
     m.magic = libwdb.RT_METABALL_INTERNAL_MAGIC
     m.threshold = threshold
     m.method = method
     cta.list_init(m.metaball_ctrl_head)
     for point in points:
         librt.rt_metaball_add_point(libwdb.byref(m), cta.doubles(cta.flatten_numbers(point[0])), point[1], point[2])
     libwdb.wdb_export(self.db_fp, name, libwdb.byref(m), libwdb.ID_METABALL, 1)
示例#6
0
 def arb8(self, name, points=(1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1)):
     libwdb.mk_arb8(self.db_fp, name, cta.doubles(points, double_count=24))
示例#7
0
 def arb5(self, name, points=(1, 1, 0, 1, -1, 0, -1, -1, 0, -1, 1, 0, 0, 0, 1)):
     libwdb.mk_arb5(self.db_fp, name, cta.doubles(points, double_count=15))
示例#8
0
 def arb4(self, name, points=(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)):
     libwdb.mk_arb4(self.db_fp, name, cta.doubles(points, double_count=12))
示例#9
0
 def arb8(self,
          name,
          points=(1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1,
                  -1, 1, -1, -1, 1, -1, 1, 1)):
     libwdb.mk_arb8(self.db_fp, name, cta.doubles(points, double_count=24))
示例#10
0
 def arb5(self,
          name,
          points=(1, 1, 0, 1, -1, 0, -1, -1, 0, -1, 1, 0, 0, 0, 1)):
     libwdb.mk_arb5(self.db_fp, name, cta.doubles(points, double_count=15))
示例#11
0
 def arb4(self, name, points=(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)):
     libwdb.mk_arb4(self.db_fp, name, cta.doubles(points, double_count=12))