LineParams Table CMeasureLines:Add

new_measurelines


The new_measurelines function is a non-class version of the CMeasureLines:new method which creates and returns a new CMeasureLines object. You must create the object before using any class methods or properties.

Syntax

C = new_measurelines()

bullet.gif    Creates a default CMeasureLines object with properties initialized to default values.

C = new_measurelines( Params )

bullet.gif    Creates a CMeasureLines object with default properties updated to values in the LineParams Table, Params.

C = new_measurelines( CMeasureLines_old )

bullet.gif    This is a copy constructor. It creates a new CMeasureLines object initialized to the members of theCMeasureLines_old argument.

Example

The following script creates a new CMeasureLines object, attaches an image window and an image, then draws an angle on the image after moving adjusting the passed coordinates to the nearby centroid position.

L = new_measurelines()

-- create a new CMeasureLines

 

 

Params =

 -- LineParams properties to change

{

  

  bSetColor = true,

 

  sColor = "0,255,0",

 

  bSetLineThk = true,

 

  nLineThk = 1.5,

 

  bSetCentroid = true,

 

  bCentroid = true,

 

}

  

L:SetParams(Params)

  

 

 

V = attachlist_imageview()

-- connect to an image window

Assert( V, "No image window")

 -- exit if no image window

-- grab an image from the window, V

 

--DO NOT declare I as "local" inside the block

 

if V:Count() > 1 then

  

  I = CImage:AttachFromList( V )

-- pick the image from the CImageView V

  Assert( I, "No Images available")

 -- exit if no image

else

 

  I = V:GetImage()

-- pick the only image in the window

end

 

x1 = 300; y1 = 205

-- coordinates of point 1

x2 = 100; y2 = 530

-- coordinates of point 2

bSuccess = L:Add(I, x1, y1, x2, y2)

-- Add the line and draw it on the image

Related Topics

CMeasureLines class

new

delete

LineParams Table

 


Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.