Model.createbestcirclecenternode#

Model.createbestcirclecenternode(collection, point_flag, any_tol, make_circle)#

Creates a node or a point at the center of the circle that best approximates the input set of lines or points. If the input entities are found to be on a straight line, then an error is returned.

Parameters:
  • collection (Collection) – The collection containing the input entities. Valid entities are nodes, points and lines.

  • point_flag (int) –

    Parameter specifying whether a node or point is created at the approximated circle center. Valid values are:

    0 - Create node.

    1 - Create point.

  • any_tol (int) –

    Parameter specifying whether the best fit is verified against the currently set geometry cleanup tolerance. Valid values are:

    0 - An error is returned, if the input entities are not on the circle within the geometry cleanup tolerance.

    1 - Tolerance is ignored and best fit circle is always calculated.

  • make_circle (int) –

    Parameter specifying whether a circle is also created:

    0 - Only center point/node is created.

    1 - Center point/node and a circle are created.

Examples#

Create a node at the center of the circle passing through nodes with IDs 11, 12 and 14#
import hm
import hm.entities as ent

model = hm.Model()

model.createbestcirclecenternode(
    collection=hm.Collection(model, ent.Node, [11, 12, 13]),
    point_flag=0,
    any_tol=1,
    make_circle=0,
)
Create a circle that approximates line with ID 21, along with a point at the center of the circle#
import hm
import hm.entities as ent

model = hm.Model()

model.createbestcirclecenternode(
    collection=hm.Collection(model, ent.Node, [21]),
    point_flag=1,
    any_tol=1,
    make_circle=1,
)