Model.body_trim_with_templine#

Model.body_trim_with_templine(collection, vector, coords, options)#

Uses coordinates specified by coords and size parameters to construct temporary line. Depending on “mode” setting in options parameter the line can be either smooth spline or a set of straight segments connecting points. The line is then used to construct cutting surface, which is then used to trim selected solids or surfaces. Depending on options parameter setting, the cutting surface itself either becomes part of the model or used only to produce trimming lines on surfaces it intersects. One more setting in options parameter controls whether the surface is generated exactly as specified by input vector and coordinates or it is also analytically extended to intersect as many surfaces from the input set as possible.

Parameters:
  • collection (Collection) – The collection containing the entities selected for trimming. Surfaces and solids are supported.

  • vector (hwTriple) – The hwTriple object defining the vector components. User can also supply a Python list of three doubles.

  • coords (hwDoubleList) – The ID of array of “double” type values specifying x, y, and z values of consecutive points used to generate temporary line.

  • options (int) –

    The options to use for trimming the selected entities.

    Bit values are used and the value is calculated as (Bit0 + 2*Bit1 + 4*Bit2 + 8*Bit3). Valid Bit options are:

    Bit0

    Trimming surface is created or extended to trim other surfaces. Valid values are:

    0 - Trimming surface is created by connecting input points and sweeping obtained line in input direction.

    1 - Trimming surface is also extended to trim as many input surfaces as possible.

    Bit1

    Line is generated as a smooth spline or a set of segments. Valid values are:

    0 - Line is generated as a smooth spline through input points.

    1 - Line is generated as a set of segments connecting input points.

    Bit2

    Trimming surface becomes permanent or temporary. Valid values are:

    0 - Trimming surface becomes part of the model.

    1 - Trimming surface is temporary and is only used to generate trimming lines on intersected surfaces.

    Bit3

    Keep open or close trimming line loop. Valid values are:

    0 - Do not close open trimming line loop.

    1 - Close trimming line loop.

    Show Bit value calculator
    Radio Button Table
    Option Name value
    Trimming surface is created or extended to trim other surfaces (Bit0)
    Line is generated as a smooth spline or a set of segments (Bit1)
    Trimming surface becomes permanent or temporary (Bit2)
    Keep open or close trimming line loop (Bit3)
    Calculated argument value: 0

Examples#

Trim solid with ID 111 by sweeping a smooth spline curve generated from three points with coordinates (0, 0.5, 11), (2, 0.5, 12), and (3, 0.7, 13) in the z-direction#
import hm
import hm.entities as ent

model = hm.Model()

model.body_trim_with_templine(
    collection=hm.Collection(model, ent.Solid, [111]),
    vector=(0, 0, 1),
    coords=[0.0, 0.5, 11.0, 2.0, 0.5, 12.0, 3.0, 0.7, 13.0],
    options=0
)
Use the same points but extend the generated surface to ensure that the solid is split as a result of this trim#
import hm
import hm.entities as ent

model = hm.Model()

model.body_trim_with_templine(
    collection=hm.Collection(model, ent.Solid, [111]),
    vector=(0, 0, 1),
    coords=[0.0, 0.5, 11.0, 2.0, 0.5, 12.0, 3.0, 0.7, 13.0],
    options=1
)