CadLayer: Difference between revisions

From SDK
Jump to navigation Jump to search
(Created page with " right|50px|link=High Level Objects Category:SDK This object holds all the data for a layer within the application. Layers are created and accessed via t...")
 
Line 132: Line 132:
::''blue(double) <span style="color: blue;>'''blue'''</span> component of colour in range 0.0 to 1.0''
::''blue(double) <span style="color: blue;>'''blue'''</span> component of colour in range 0.0 to 1.0''


===:SetColor (double red,  double green,  double blue)===
Set the color for the layer (U.S spelling)
::''red(double) <span style="color: red;>'''red'''</span> component of colour in range 0.0 to 1.0''
::''green(double) <span style="color: green;>'''green'''</span> component of colour in range 0.0 to 1.0''
::''blue(double) <span style="color: blue;>'''blue'''</span> component of colour in range 0.0 to 1.0''




[[File:Back.jpg|right|50px|link=High Level Objects]]


[[File:Back.jpg|right|50px|link=High Level Objects]]
==References==
==References==
'''Please Note:''' The base material for the contents found in this WiKi was sourced from Vectric Lua Interface for Gadgets, version 2.05, published September 12, 2018. by Vectric Ltd. Most current document from Vertric can be downloaded at [https://gadgets.vectric.com/developerinfo.html Vertric Developer Information]
'''Please Note:''' The base material for the contents found in this WiKi was sourced from Vectric Lua Interface for Gadgets, version 2.05, published September 12, 2018. by Vectric Ltd. Most current document from Vertric can be downloaded at [https://gadgets.vectric.com/developerinfo.html Vertric Developer Information]

Revision as of 19:09, 5 May 2023

Back.jpg

This object holds all the data for a layer within the application. Layers are created and accessed via the CadLayerManager object. A layer maintains a list of CadObjects.

Properties

.Colour

Interaction: Interaction: Read and Write 32 bit (integer) get or set the colour for a layer as a COLORREF (32 bit colour value)


.Color

Interaction: Interaction: Read and Write 32 bit (integer) get or set the colour for a layer as a COLORREF (32 bit colour value) this is the U.S spelling version of the method above!

Sample Code

function MakeLayers()
   local job = VectricJob()
  if not(job.Exists) then
    DisplayMessageBox("Error: The Gadget cannot run without a job being setup.\n" ..
                      "Select: 'Create a new file' under 'Startup Tasks' and \n" ..
                      "specify the material dimensions")
    return false ;
  end
  local layer = job.LayerManager:GetLayerWithName("Text")
        layer:SetColor (0.0, 1.0, 0.0)    -- Green
        layer = job.LayerManager:GetLayerWithName("Handle")
        layer:SetColor (0.0, 0.0, 1.0)    -- Blue
  return true
 end

.Count

Interaction: Read Only

Returns: (integer) Returns the number of CadObjects present on the layer


.IsBitmapLayer

Interaction: Read Only

Returns: (bool) true if this is a bitmap layer. The bitmap layer is used for imported bitmaps and is placed at the start of the layer list so that bitmaps are drawn before vectors.


.IsEmpty

Interaction: Read Only

Returns: (bool) true if the layer has no objects on it.


.IsSystemLayer

Interaction: Read Only

Returns: (bool) Returns(bool) true if this is a system layer. System layers are used for holding items such as toolpath previews.


.Locked

Interaction: Read and Write:(bool) Get or set the locked property for the layer


.Name

Interaction: Read and Write:(string) get or set the name for the layer


.Visible

Interaction: Read and Write:(bool) Get or set the visible property for the layer


.Id

Interaction: Read Only

Returns: luaUUID (Id of this layer)


RawId

Interaction: Read Only

Returns: (UUID) The unique identifier for this layer

Methods

:AddObject( CadObject object, bool on_current_sheet)

Add passed object to this layer object (CadObject) the object (contour) to add to layer object becomes property of layer on_current_sheet(bool) this should always be true, and the object is created on the current sheet. If false the sheet from the object would be retained, but as this sheet property is not controllable from Lua, false should not be used in normal operation.


:Find( UUID id)

Returns: the position in the list for the object with the passed id. If no object is found the returned position is nil

id (UUID) id for object

:GetHeadPosition()

Returns: (POSITION) a variable to allow access to the head of the list of objects on layer


:GetTailPosition()

Returns: (POSITION) a variable to allow access to the tail of the list of objects on layer


:GetNext( POSITION pos)

Returns: Both the object at the current position AND a new value for position pointing to the next item in the list (or nil if at end of list)

pos (POSTION) current position in list


:GetPrev( POSITION pos)

Returns: Both the object at the current position AND a new value for position, pointing to the previous item in the list (or nil if at start of list)

pos (POSTION) current position in list


:GetAt( POSITION pos)

Returns: the object at the passed position

pos (POSTION) position in list


:RemoveObject( CadObject object)

Removes passed object from this layer. Object becomes property of the script. Object removed or nil if object was not found on layer.

Object (CadObject) the object (contour) to remove from layer object becomes property of caller

:RemoveAt( POSITION pos)

Removes the CadObject at the passed position and Returns it.

pos (POSTION) position in list


:SetColour( double red, double green, double blue)

Set the colour for the layer

red(double) red component of colour in range 0.0 to 1.0
green(double) green component of colour in range 0.0 to 1.0
blue(double) blue component of colour in range 0.0 to 1.0


Back.jpg

References

Please Note: The base material for the contents found in this WiKi was sourced from Vectric Lua Interface for Gadgets, version 2.05, published September 12, 2018. by Vectric Ltd. Most current document from Vertric can be downloaded at Vertric Developer Information