CMeasureLines:Add
The Add method adds a line marker to the image and reports measurements of its length and angle from the positive x-axis. The Line Measurement toolbar is opened if not already open. See the toolbar description in the Mira User's Guide.
bSuccess = CMeasureLines:Add( Image_obj, x1, y1, x2, y2 ) where Image_obj is a CImage object. x1 and y1 are the coordinates of the first point. x2 and y2 are the coordinates of the second point. On success, bSuccess is returned as true. |
Suppose a CImage object I exists. The following script creates a new CMeasureLines object and measures its length and angle. The passed coordinates for both ends of the line are updated to the local centroid positions by setting properties in the LineParams table.
|
-- create a new CMeasureLines object |
|
|
|
-- LineParams properties to change |
|
|
|
|
|
|
|
|
|
|
|
-- centroid the first point |
|
-- centroid the first point |
|
-- centroid the second point |
|
-- centroid the second point |
|
|
|
|
|
|
|
-- connect to an image window |
|
-- exit if no image window |
-- grab an image from the window, V |
|
|
|
|
-- pick the image from CImageView V |
|
-- exit if no image |
|
|
|
-- pick the only image in the window |
|
|
|
-- initial coordinates of first point |
|
-- initial coordinates of second point |
|
-- Add the measurement to the image |
CMeasureLines class, LineParams Table
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics,
Inc. All Rights Reserved.