Model.hm_getbestcirclecenter#
- Model.hm_getbestcirclecenter(entityCollection, anyTol=0)#
Calculates and returns the center point coordinates and radius of the circle that approximates the input set of lines, nodes or points. If the input entities are found to be on a straight line then an error is returned.
- Parameters:
entityCollection (Collection) – The collection containing the input entities. Valid entities are nodes, points, or lines.
anyTol (int) –
Parameter specifying whether the best fit is verified against the currently set geometry cleanup tolerance. Valid values are:
0 - Error is returned if input entities are not on the circle within geometry cleanup tolerance.
1 - Tolerance is ignored and best fit circle is always calculated.
- Returns:
hwReturnStatus- Status objectHmQueryResult- Result object containing the output values:circleCenter (numpy.ndarray) - The x, y, z coordinates of the calculated circle center
radius (double) - The radius of the circle
Examples#
Get the center and radius of the circle pass through nodes with IDs 11 , 12 and 14#import hm import hm.entities as ent model = hm.Model() nodes_collection = hm.Collection(model, ent.Node, [11, 12, 14]) _, result = model.hm_getbestcirclecenter(entityCollection=nodes_collection) print("Circle Center:", result.circleCenter) print("Radius:", result.radius)
Get the center and radius of the circle that approximates line with ID 21#import hm import hm.entities as ent model = hm.Model() lines_collection = hm.Collection(model, ent.Line, [21]) _, result = model.hm_getbestcirclecenter(entityCollection=lines_collection) print("Circle Center:", result.circleCenter) print("Radius:", result.radius)