示例#1
0
    def volmdlr_primitives(self):
        primitives = self.interior.volmdlr_primitives()

        front_left_wheel_frame = vm.Frame3D(
            vm.Point3D(0, 0.5 * self.track,
                       0.5 * self.front_wheel.tyre.diameter), vm.Y3D, -vm.X3D,
            vm.Z3D)
        primitives.extend(
            self.front_wheel.volmdlr_primitives(frame=front_left_wheel_frame))

        front_right_wheel_frame = vm.Frame3D(
            vm.Point3D(0, -0.5 * self.track,
                       0.5 * self.front_wheel.tyre.diameter), -vm.Y3D, vm.X3D,
            vm.Z3D)
        primitives.extend(
            self.front_wheel.volmdlr_primitives(frame=front_right_wheel_frame))

        rear_left_wheel_frame = vm.Frame3D(
            vm.Point3D(-self.wheelbase, 0.5 * self.track,
                       0.5 * self.rear_wheel.tyre.diameter), vm.Y3D, -vm.X3D,
            vm.Z3D)
        primitives.extend(
            self.rear_wheel.volmdlr_primitives(frame=rear_left_wheel_frame))

        rear_right_wheel_frame = vm.Frame3D(
            vm.Point3D(-self.wheelbase, -0.5 * self.track,
                       0.5 * self.rear_wheel.tyre.diameter), -vm.Y3D, vm.X3D,
            vm.Z3D)
        primitives.extend(
            self.rear_wheel.volmdlr_primitives(frame=rear_right_wheel_frame))

        if self.outside_xz_contour:
            outside_xz_contour2 = self.outside_xz_contour.offset(0.01)
            if outside_xz_contour2.area() < self.outside_xz_contour.area():
                primitives.append(
                    p3d.ExtrudedProfile(-0.4 * self.track * vm.Y3D,
                                        vm.X3D,
                                        vm.Z3D,
                                        self.outside_xz_contour,
                                        [outside_xz_contour2],
                                        vm.Y3D * 0.8 * self.track,
                                        alpha=0.5))
            else:
                primitives.append(
                    p3d.ExtrudedProfile(-0.4 * self.track * vm.Y3D,
                                        vm.X3D,
                                        vm.Z3D,
                                        outside_xz_contour2,
                                        [self.outside_xz_contour],
                                        vm.Y3D * 0.8 * self.track,
                                        alpha=0.5))

        return primitives
示例#2
0
    def volmdlr_primitives(self, frame=vm.OXYZ, x_setting=0., z_setting=0):
        cushion_contour = self.cushion_contour().translation(
            vm.Point2D(x_setting, z_setting))
        cushion = p3d.ExtrudedProfile(frame.origin -
                                      0.5 * self.width * frame.v,
                                      frame.u,
                                      frame.w,
                                      cushion_contour, [],
                                      self.width * frame.v,
                                      name='cushion',
                                      color=(0.2, 0.2, 0.2))

        backrest_contour = self.backrest_contour().translation(
            vm.Point2D(x_setting, z_setting))
        backrest = p3d.ExtrudedProfile(frame.origin -
                                       0.5 * self.width * frame.v,
                                       frame.u,
                                       frame.w,
                                       backrest_contour, [],
                                       self.width * frame.v,
                                       color=(0.2, 0.2, 0.2),
                                       name='backrest')

        headrest_contour = self.headrest_contour().translation(
            vm.Point2D(x_setting, z_setting))
        headrest = p3d.ExtrudedProfile(frame.origin -
                                       0.25 * self.width * frame.v,
                                       frame.u,
                                       frame.w,
                                       headrest_contour, [],
                                       0.5 * self.width * frame.v,
                                       color=(0.2, 0.2, 0.2),
                                       name='headrest')

        floor = faces.Plane3D(vm.Frame3D(frame.origin-self.floor_height*vm.Z3D,
                                      vm.X3D, vm.Y3D, vm.Z3D))\
                        .rectangular_cut(0.25, 1, -0.5*self.width, 0.5*self.width)

        roof = faces.Plane3D(vm.Frame3D(frame.origin+self.roof_height*vm.Z3D,
                                      vm.X3D, vm.Y3D, vm.Z3D))\
                        .rectangular_cut(-0.15, 0.15, -0.5*self.width, 0.5*self.width)

        primitives = [cushion, backrest, headrest, floor, roof]
        return primitives
示例#3
0
 def voldmlr_primitives(self):
     contour = self.contour()
     volumes = [
         p3d.ExtrudedProfile(vm.O3D, vm.X3D, vm.Z3D, contour, [], vm.Y3D)
     ]
     return volumes
示例#4
0
c1 = vm.Contour2D([l1, l2, l3, l4])

p8 = vm.Point2D((1, 1))
p9 = vm.Point2D((2, 1))
p10 = vm.Point2D((2, 2))
p11 = vm.Point2D((1, 2))
#inner=vm.Circle2D(vm.Point2D((2,2)), 0.5)
inner = p2d.ClosedRoundedLineSegments2D([p8, p9, p10, p11], {})
c2 = vm.Contour2D([inner])

#ax = l1.MPLPlot()
#l2.MPLPlot(ax=ax)
#l3.MPLPlot(ax=ax)
#l4.MPLPlot(ax=ax)

profile = p3d.ExtrudedProfile(vm.o3D, vm.x3D, vm.y3D, c1, [c2],
                              vm.Vector3D((0, 0, 1)))
profile.MPLPlot()

model = vm.VolumeModel([profile])
model.BabylonShow()

#%%

p1 = vm.Point2D((0, 0))
p2 = vm.Point2D((2, 0))
p3 = vm.Point2D((2, 2))
p4 = vm.Point2D((0, 2))

p5 = vm.Point2D((0.5, 0.5))
p6 = vm.Point2D((1.5, 0.5))
p7 = vm.Point2D((1.5, 1.5))
示例#5
0
        1: 0.01,
        2: 0.015,
        3: 0.020,
        4: 0.012,
        5: 0.008
    },
    adapt_radius=True)

outer_contour = inner_contour.offset(-thickness)

a = inner_contour.plot()
outer_contour.plot(a)

sides = primitives3d.ExtrudedProfile(vm.O3D,
                                     vm.X3D,
                                     vm.Y3D,
                                     outer_contour, [inner_contour],
                                     (height - 2 * thickness) * vm.Z3D,
                                     name='sides')

bottom = primitives3d.ExtrudedProfile(vm.O3D,
                                      vm.X3D,
                                      vm.Y3D,
                                      outer_contour, [],
                                      -thickness * vm.Z3D,
                                      name='bottom')

screw_holes_rl = inner_contour.offset(-(thickness + screw_holes_clearance +
                                        0.5 * screw_holes_diameter))
screw_holes = []
l = screw_holes_rl.length()
for i in range(n_screws):
示例#6
0
import volmdlr.primitives2d as primitives2d

p1 = vm.Point2D(0, 0)
p2 = vm.Point2D(0.1, 0.)
p3 = vm.Point2D(0.1, 0.2)
p4 = vm.Point2D(0.05, 0.1)
p5 = vm.Point2D(0., 0.21)
p6 = vm.Point2D(0.05, 0.05)

p7 = vm.Point2D(0.06, 0.05)
p8 = vm.Point2D(0.04, 0.07)

radius = {0: 0.01, 2: 0.01, 3: 0.015}

outer_profile = primitives2d.ClosedRoundedLineSegments2D([p1, p2, p3, p4, p5],
                                                         radius)
l1 = edges.LineSegment2D(p6, p7)
l2 = edges.LineSegment2D(p7, p8)
l3 = edges.LineSegment2D(p8, p6)
c2 = wires.Contour2D([l1, l2, l3])

profile = primitives3d.ExtrudedProfile(vm.O3D,
                                       vm.Y3D,
                                       vm.Z3D,
                                       outer_profile, [c2],
                                       vm.X3D * 0.1,
                                       name='extrusion')

model = vm.core.VolumeModel([profile])

model.babylonjs()
示例#7
0
#p7=vm.Point2D((0,r4))
l2 = vm.Circle2D(pc, r4)

c1 = vm.Contour2D(L)
c2 = vm.Contour2D([l2])

po = vm.Point3D((0, 0, 0))
xp = vm.Vector3D((1, 0, 0))
yp = vm.Vector3D((0, 1, 0))

#c1.MPLPlot()
#extr_vect=vm.Vector3D((0,0,e))

profile_straight = primitives3D.ExtrudedProfile(po,
                                                xp,
                                                yp,
                                                c1, [c2], (0, 0, e),
                                                name='straight')
#
#model_straight=vm.VolumeModel([profile_straight])

profile_helical = primitives3D.HelicalExtrudedProfile(po,
                                                      xp,
                                                      yp,
                                                      vm.Vector3D((0, 0, 0)),
                                                      vm.Vector3D((0, 0, e)),
                                                      28 * 3.14 / 180,
                                                      c1, [c2],
                                                      name='helical')

model = vm.VolumeModel([profile_helical, profile_straight])
示例#8
0
 def volmdlr_primitives(self, center=vm.O3D, dir1=vm.X3D, dir2=vm.Y3D):
     contour = self.contour()
     dir3 = dir1.cross(dir2)
     profile = p3d.ExtrudedProfile(center, dir1, dir2, contour, [], self.thickness * dir3,
                                   name='extrusion')
     return [profile]
示例#9
0
    def volmdlr_primitives(self, frame=vm.OXYZ):
        chest = p3d.ExtrudedProfile(frame.origin -
                                    0.5 * self.passenger.chest_depth * frame.v,
                                    frame.u,
                                    frame.w,
                                    self.chest_contour(), [],
                                    self.passenger.chest_depth * frame.v,
                                    name='chest')

        head = p3d.ExtrudedProfile(frame.origin -
                                   0.5 * self.passenger.head_depth * frame.v,
                                   frame.u,
                                   frame.w,
                                   self.head_contour(), [],
                                   self.passenger.head_depth * frame.v,
                                   name='head')

        # Arms
        upper_arm_left = p3d.ExtrudedProfile(
            frame.origin - (0.5 * self.passenger.chest_depth +
                            self.passenger.upper_arm_depth) * frame.v,
            frame.u,
            frame.w,
            self.upper_arm_contour(), [],
            self.passenger.upper_arm_depth * frame.v,
            name='upper_arm_left')

        upper_arm_right = upper_arm_left.translation(
            (self.passenger.upper_arm_depth + self.passenger.chest_depth) *
            frame.v)
        upper_arm_right.name = 'Upper arm right'

        # lower_arm_contour.plot(ax = ax)
        lower_arm_left = p3d.ExtrudedProfile(
            frame.origin - (self.passenger.lower_arm_depth +
                            0.5 * self.passenger.chest_depth) * frame.v,
            frame.u,
            frame.w,
            self.lower_arm_contour(), [],
            self.passenger.lower_arm_depth * frame.v,
            name='lower_arm_left')

        lower_arm_right = lower_arm_left.translation(
            (self.passenger.upper_arm_depth + self.passenger.chest_depth) *
            frame.v)
        lower_arm_right.name = 'Lower arm right'

        # Legs
        upper_leg_left = p3d.ExtrudedProfile(
            frame.origin + 0.3 * self.passenger.upper_leg_depth * frame.v,
            frame.u, frame.w, self.upper_leg_contour(), [],
            self.passenger.upper_leg_depth * frame.v)

        upper_leg_right = upper_leg_left.translation(
            -1.6 * self.passenger.upper_leg_depth * frame.v)
        upper_leg_right.name = 'Upper leg right'

        lower_leg_left = p3d.ExtrudedProfile(
            frame.origin + 0.3 * self.passenger.upper_leg_depth * frame.v,
            frame.u,
            frame.w,
            self.lower_leg_contour(), [],
            self.passenger.lower_leg_depth * frame.v,
            name='Lower leg left')

        lower_leg_right = lower_leg_left.translation(
            -(self.passenger.lower_leg_depth +
              0.6 * self.passenger.upper_leg_depth) * frame.v)
        lower_leg_right.name = 'Lower leg left'

        return [
            head, chest, upper_arm_right, upper_arm_left, lower_arm_right,
            lower_arm_left, upper_leg_left, upper_leg_right, lower_leg_left,
            lower_leg_right
        ]