(self)
| 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]], |
nothing calls this directly
no test coverage detected