C2.f-h Fabrication Preparation

Generate the CNC-cutting curve inside the machine's workspace.

Objective

You will learn how to reorient the mesh strip with the help of a bounding box for the CNC workspace, create the CNC-cutting polygon with a seam offset and check if it is within the limits of the CNC workspace.

Procedure

f. Outline with Seam

Create the strip outline as a polygon and add a seam with an offset for the CNC-cutting curve.

def seam(mesh, SEAM):
    """Create the strip outline with a seam offset.
    """
    outline = [mesh.vertex_coordinates(key) for key in mesh.vertices_on_boundary(ordered=True)]
    seam = offset_polygon(outline, -SEAM)
    seam = Polygon(seam)

    return seam
# ==============================================================================
# Visualize Rhino
# ==============================================================================

baselayer = "CSD2::C2::MaterializeFabric"
artist = MeshArtist(strip_mesh, layer=baselayer+"::{}::Strip{}".format("QuadMesh", strip_mesh.attributes['strip']))
artist.clear_layer()
artist.draw()

artist = MeshArtist(strip_flat, layer=baselayer+"::{}::Strip{}".format("FlatQuadMesh", strip_mesh.attributes['strip']))
artist.clear_layer()
artist.draw()

compas_rhino.clear_layer(baselayer+"::Outline")
artist = PolygonArtist(outline, layer=baselayer+"::Outline")
artist.draw()

g1. Bounding Box

Compute the oriented minimum bounding box as a polygon.

find out more about rpc and Proxies

# ==============================================================================
# Fabrication Preparation
# ==============================================================================

# f ---------------------------------------------------------------------------
# compute outline for fabrication by adding a seam
outline = seam(strip_flat, SEAM)

# g1 ---------------------------------------------------------------------------
# compute oriented minimum bounding box as polygon
bbox = oriented_bounding_box_xy_numpy(outline)
bbox_polygon = Polygon(bbox)
# ==============================================================================
# Visualize Rhino
# ==============================================================================

...

compas_rhino.clear_layer(baselayer+"::Bbox")
artist = PolygonArtist(bbox_polygon, layer=baselayer+"::Bbox")
artist.draw(show_points=False)

g2. Transformation

Define the origin and target frame for the transformation of the outline to align with the CNC workspace with the help of the bounding box. Transform the outline.

...

# g2 ---------------------------------------------------------------------------
# define origin frame for transformation
origin = bbox[0]
xaxis = subtract_vectors(bbox[1], bbox[0])
yaxis = subtract_vectors(bbox[3], bbox[0])
frame = Frame(origin, xaxis, yaxis)

# define target frame for transformation
frame_to = Frame.worldXY()

# define transformation
T = Transformation.from_frame_to_frame(frame, frame_to)

# reorient outline to cnc workspace
cuttingline = outline.transformed(T)
# ==============================================================================
# Visualize Rhino
# ==============================================================================

...

compas_rhino.clear_layer(baselayer+"::Outline")
artist = PolygonArtist(cuttingline, layer=baselayer+"::Cuttingline")
artist.draw()

artist = FrameArtist(frame, layer=baselayer+"::FrameOrigin")
artist.draw()
artist = FrameArtist(frame_to, layer=baselayer+"::FrameTarget")
artist.draw()

There is a problem with strip 0: it is flipped in this step! But not strip 8, so what do we do to unify their orientations? We don't want to flip the fabric because it has a coating on only one side.

g3. Correction of Orientation

We must make sure the strips are always oriented with their upper surface facing upwards.

The normal (hence cycling direction) of the bounding box is sometimes pointing in the positive and sometimes in the negative z-direction. Thus, we must reverse the order of the bounding box if its normal is pointing in the negative z-direction.

... g1

# g3 ---------------------------------------------------------------------------
# because the normal of the bouning box is sometimes in prositive and sometimes in negative z-direction
# reverse bbox order if its pointing downwards = flip cycyle
if bbox_polygon.normal[2] < 0:
    bbox.reverse()
    bbox_polygon = Polygon(bbox)
    
... g2

h. Workspace Dimensions

Lastly, we must check whether the strip fits inside the CNC-cutter workspace. Assuming the fabric can be shifted forward in its long direction, the short direction must respect the machine's maximum width. If this is not respected, an Exception should be raised.

# check cnc-workspace dimensions
short_length = length_vector_xy(yaxis)
if short_length > CNC_WIDTH:
    raise Exception('The strip is too wide for the cnc machine.')

If the strip does not fit, we could either strip into the short direction, or find a CNC-cutting machine with a larger workspace, or split the strip's length of those that don't fit into half.

You have accomplished the materialisation of the membrane. This was the last step for the cable nets and membranes module. Congratulations!

Last updated