Ejemplo n.º 1
0
        mini, maxi), random.randint(mini, maxi)
    c1, c2, c3 = random.randrange(0, 100, 1), random.randrange(
        0, 100, 1), random.randrange(0, 100, 1)
    pts1.append(volmdlr.Point3D((a1 * c1 / 100, a2 * c2 / 100, a3 * c3 / 100)))

radius1 = {
    1: 0.03,
    2: 0.01,
    3: 0.07,
    4: 0.01
}  #, 5: 0.07, 6: 0.02, 7: 0.03, 8: 0.04}
rl1 = primitives3D.OpenedRoundedLineSegments3D(pts1,
                                               radius1,
                                               adapt_radius=True,
                                               name='wire1')
sweep1 = primitives3D.Sweep(contour1, rl1, name='pipe1')

pts2 = []
for k in range(nb_point2):
    a1, a2, a3 = random.randint(mini, maxi), random.randint(
        mini, maxi), random.randint(mini, maxi)
    c1, c2, c3 = random.randrange(0, 100, 1), random.randrange(
        0, 100, 1), random.randrange(0, 100, 1)
    pts2.append(volmdlr.Point3D((a1 * c1 / 100, a2 * c2 / 100, a3 * c3 / 100)))

radius2 = {1: 0.01, 2: 0.05, 3: 0.06}  #, 4: 0.02, 5: 0.01, 6: 0.03}
rl2 = primitives3D.OpenedRoundedLineSegments3D(pts2,
                                               radius2,
                                               adapt_radius=True,
                                               name='wire2')
sweep2 = primitives3D.Sweep(contour2, rl2, name='pipe2')
Ejemplo n.º 2
0
radius_circle = 0.008
c = volmdlr.Circle2D(volmdlr.Point2D((0, 0)), radius_circle)
contour = volmdlr.Contour2D([c])
pt0 = volmdlr.Point3D((0.01, 0.04, 0.16))
pt1 = volmdlr.Point3D((0.03, 0, 0.2))
pt2 = volmdlr.Point3D((0.45, 0.01, 0.1))
pt3 = volmdlr.Point3D((0.45, 0, -0.1))
pt4 = volmdlr.Point3D((0.3, 0.04, -0.02))
pts = [pt0, pt1, pt2, pt3, pt4]
radius = {1: 0.03, 2: 0.01, 3: 0.07}
rl = primitives3D.OpenedRoundedLineSegments3D(pts,
                                              radius,
                                              adapt_radius=True,
                                              name='wire')
sweep = primitives3D.Sweep(contour, rl, name='pipe')

pt10 = volmdlr.Point3D((0.02, 0.22, 0.25))
pt11 = volmdlr.Point3D((0.02, 0.24, 0.25))
pt12 = volmdlr.Point3D((0.6, 0.24, 0.20))
pt13 = volmdlr.Point3D((0.40, 0.17, 0.13))
pts1 = [pt10, pt11, pt12, pt13]
radius1 = {1: 0.01, 2: 0.05}

rl1 = primitives3D.OpenedRoundedLineSegments3D(pts1,
                                               radius1,
                                               adapt_radius=True,
                                               name='wire1')
sweep1 = primitives3D.Sweep(contour, rl1, name='pipe1')
# fig = plt.figure()
# ax = fig.add_subplot(111, projection='3d')
Ejemplo n.º 3
0
                vm.Point2D((0, 0)),
                vm.Point2D(
                    ((-1 + math.sqrt(2) / 2) * r, r * math.sqrt(2) / 2)),
                vm.Point2D((-r, r)))

            contour_sweep = outer_contour_floor.Offset(r)

            contour = vm.Contour2D([arc])
            wire_sweep = vm.Wire3D([
                p.To3D(
                    origin +
                    extrusion_vector * list_height_polyfloor[enum + 1], x, y)
                for p in contour_sweep.primitives
            ])
            sweep = primitives3D.Sweep(contour,
                                       wire_sweep,
                                       alpha=alpha,
                                       name='congé')

            list_component_hat.append(sweep)
            list_contour_floor.append(contour_sweep)
        else:
            r = 0

        if enum == len(list_polyfloor) - 2:
            if with_borders:
                list_component_hat.pop()
                r_top = thickness_min
                arc_top = vm.Arc2D(
                    vm.Point2D((0, 0)),
                    vm.Point2D(((-1 + math.sqrt(2) / 2) * r_top,
                                r_top * math.sqrt(2) / 2)),
Ejemplo n.º 4
0
p2 = vm.Point3D((-0.150, 0, 0))
p3 = vm.Point3D((-0.150, 0.215, 0))
p4 = vm.Point3D((-0.150, 0.215, -0.058))
p5 = vm.Point3D((-0.175, 0.186, -0.042))

points = [p1, p2, p3, p4, p5]
radius = {1: 0.015, 2: 0.020, 3: 0.005}

current_point = p5.vector
#points = [p1, p2]
#radius = {1: 0.010}
for i in range(14):
    current_point += 0.300 * (npy.random.random(3) - 0.5)
    points.append(vm.Point3D(current_point))
    radius[4 + i] = 0.01 + 0.03 * random.random()
#print(radius)
c = vm.Circle3D(p1, 0.008, p2 - p1)

rl = primitives3D.RoundedLineSegments3D(points,
                                        radius,
                                        closed=False,
                                        adapt_radius=True,
                                        name='wire')
contour = vm.Contour3D([c])

sweep = primitives3D.Sweep(contour, rl, name='Random pipe')

m = vm.VolumeModel([('Random Pipe', [sweep])])

m.FreeCADExport('sweep')
Ejemplo n.º 5
0
 def CADVolume(self):
     normal_section = (self.arc.start - self.arc.center).Cross(self.arc.normal)
     section = vm.Contour3D([vm.Circle3D(self.arc.start, self.radius+0.001, normal_section)])
     return p3D.Sweep(section, vm.Wire3D([self.arc]))