MCPcopy
hub / github.com/CadQuery/cadquery / test_assembleEdges

Method test_assembleEdges

tests/test_cadquery.py:4204–4282  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4202 )
4203
4204 def test_assembleEdges(self):
4205
4206 # Plate with 5 sides and 2 bumps, one side is not co-planar with the other sides
4207 # Passes an open wire to assembleEdges so that IsDone is true but Error returns 2 to test the warning functionality.
4208 edge_points = [
4209 [-7.0, -7.0, 0.0],
4210 [-3.0, -10.0, 3.0],
4211 [7.0, -7.0, 0.0],
4212 [7.0, 7.0, 0.0],
4213 [-7.0, 7.0, 0.0],
4214 ]
4215 edge_wire = Workplane("XY").polyline(
4216 [(-7.0, -7.0), (7.0, -7.0), (7.0, 7.0), (-7.0, 7.0)]
4217 )
4218 edge_wire = edge_wire.add(
4219 Workplane("YZ")
4220 .workplane()
4221 .transformed(offset=Vector(0, 0, -7), rotate=Vector(45, 0, 0))
4222 .spline([(-7.0, 0.0), (3, -3), (7.0, 0.0)])
4223 )
4224 edge_wire = [o.vals()[0] for o in edge_wire.all()]
4225 edge_wire = Wire.assembleEdges(edge_wire)
4226
4227 # Embossed star, need to change optional parameters to obtain nice looking result.
4228 r1 = 3.0
4229 r2 = 10.0
4230 fn = 6
4231 edge_points = [
4232 [r1 * math.cos(i * math.pi / fn), r1 * math.sin(i * math.pi / fn)]
4233 if i % 2 == 0
4234 else [r2 * math.cos(i * math.pi / fn), r2 * math.sin(i * math.pi / fn)]
4235 for i in range(2 * fn + 1)
4236 ]
4237 edge_wire = Workplane("XY").polyline(edge_points)
4238 edge_wire = [o.vals()[0] for o in edge_wire.all()]
4239 edge_wire = Wire.assembleEdges(edge_wire)
4240
4241 # Points on hexagonal pattern coordinates, use of pushpoints.
4242 r1 = 1.0
4243 fn = 6
4244 edge_points = [
4245 [r1 * math.cos(i * 2 * math.pi / fn), r1 * math.sin(i * 2 * math.pi / fn)]
4246 for i in range(fn + 1)
4247 ]
4248 surface_points = [
4249 [0.25, 0, 0.75],
4250 [-0.25, 0, 0.75],
4251 [0, 0.25, 0.75],
4252 [0, -0.25, 0.75],
4253 [0, 0, 2],
4254 ]
4255 edge_wire = Workplane("XY").polyline(edge_points)
4256 edge_wire = [o.vals()[0] for o in edge_wire.all()]
4257 edge_wire = Wire.assembleEdges(edge_wire)
4258
4259 # Gyroïd, all edges are splines on different workplanes.
4260 edge_points = [
4261 [[3.54, 3.54], [1.77, 0.0], [3.54, -3.54]],

Callers

nothing calls this directly

Calls 10

WorkplaneClass · 0.85
VectorClass · 0.85
polylineMethod · 0.80
transformedMethod · 0.80
workplaneMethod · 0.80
allMethod · 0.80
assembleEdgesMethod · 0.80
addMethod · 0.45
splineMethod · 0.45
valsMethod · 0.45

Tested by

no test coverage detected