Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions tests/sample_assemblies.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
import cadquery as cq


def generate_nested_boxes():
"""
Generates a simple assembly of two cubes where one is nested inside the other.
"""

# Cube that is nested completely inside the other one
inside_cube = cq.Workplane().box(5, 5, 5)

# Use the inside cube to make a void inside the outside cube
outside_cube = cq.Workplane().box(10, 10, 10)
outside_cube = outside_cube.cut(inside_cube)

# Create the assembly
assy = cq.Assembly()
assy.add(
outside_cube,
name="outside_cube",
loc=cq.Location(cq.Vector(0, 0, 0)),
color=cq.Color("blue"),
)
assy.add(
inside_cube,
name="inside_cube",
loc=cq.Location(cq.Vector(0, 0, 0)),
color=cq.Color("red"),
)

return assy


def generate_simple_nested_boxes():
"""
Generates the simplest assembly case where two boxes are nested inside each other.
Expand Down
14 changes: 14 additions & 0 deletions tests/smoke_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
import assembly_mesh_plugin.plugin
from tests.sample_assemblies import (
generate_nested_boxes,
generate_simple_nested_boxes,
generate_test_cross_section,
generate_assembly,
)


def test_nested_cubes():
"""
Tests to make sure that the nested cubes do not cause the correct number of surfaces
in the mesh.
"""

# Create the basic assembly
assy = generate_nested_boxes()

# Create a mesh that has all the faces tagged as physical groups
assy.saveToGmsh(mesh_path="tagged_nested_boxes.msh")


def test_basic_assembly():
"""
Tests to make sure that the most basic assembly works correctly with tagging.
Expand Down
Loading