Model.trim_by_offset_edges#

Model.trim_by_offset_edges(surfs, lines, offset, break_mode, mode, break_angle)#

Offset selected surface edges and trim attached surfaces.

Parameters:
  • surfs (Collection) – The collection containing the surface entities to perform the operation. If provided collection is empty, then all surfaces attached to selected lines are trimmed.

  • lines (Collection) – The collection containing the line entities to be offset and used for trimming. If provided collection is empty, then all lines on selected surfaces are offset and used for trimming selected surfaces.

  • offset (double) – Offset distance value.

  • break_mode (int) –

    Controls connection of lines connected on convex vertex (see note). Used together with break_angle.

    0 - Connect breaks by the straight segments (default).

    1 - Connect breaks by the arcs.

    2 - Do not connect breaks.

  • mode (int) –

    Bitwise operation mode (Bit0 + 2*Bit1).

    Valid Bit options are:

    Bit 0

    Trim mode. Valid values are:

    0 - Trim selected surfaces by offset lines.

    1 - Do not trim surfaces but create offset lines and put them in the lines selection markmask.

    Bit 1

    Shrink mode. Valid values are:

    0 - Trim surfaces and keep all trimmed pieces

    1 - Trim surfaces and remove parts between original and offset lines

    Other Bits are reserved for future use and must be 0.

    Show Bit value calculator
    Radio Button Table
    Option Name Value
    Trim mode (Bit0)
    Shrink mode (Bit1)
    Calculated argument value: 0

  • break_angle (double) –

    Angle value to control extension of offset edges. Setting to 0.0 corresponds to default value of 30 degrees (see note).

    Note

    For break_angle and break_mode, normal offset of lines connected at convex vertex creates a break between line ends. In order to maintain connectivity between lines, the ends must be connected. If the vertex angle is larger than break_angle, connect ends by extending and intersecting them. If the angle is smaller than break_angle, connect ends either by a straight line (break_mode = 0) or by a circular arc (break_mode = 1).

Example#

Create a “ generic washer “ of width 5.0#
import hm
import hm.entities as ent

model = hm.Model()

# Creating collection of lines interactively
collection_lines = hm.CollectionByInteractiveSelection(model, ent.Line)

model.trim_by_offset_edges(
    surfs=hm.Collection(model, ent.Surface, populate=False),
    lines=collection_lines,
    offset=5.0,
    break_mode=0,
    mode=0,
    break_angle=0.0,
)
Shrink surfaces#
import hm
import hm.entities as ent

model = hm.Model()

# Creating collection of surfaces interactively
collection_surfaces = hm.CollectionByInteractiveSelection(model, ent.Surface)

model.trim_by_offset_edges(
    surfs=collection_surfaces,
    lines=hm.Collection(model, ent.Line, populate=False),
    offset=5.0,
    break_mode=0,
    mode=2,
    break_angle=0.0,
)