CadMarker

From SDK
Jump to navigation Jump to search
Back.jpg

This object represents a ‘marker’ in the program which can be used to label items. CadMarkers are not machinable or selectable. It is derived from CadObject and has all the properties of CadObject available.



Constructor

CadMarker(string text, Point2D pt, integer pixel_size)

A CadMarker at passed position text -string – text for marker object pt -Point2D – position for marker

pixel_size pt -integer – size marker is drawn at in pixels

Properties

.Text

Read/Write – string – Text displayed at marker



.Position

Read/Write – Point2D – Position for marker

Methods

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

Set colour for marker

red - double – red value for colour in range 0-1.0
green - double – green value for colour in range 0-1.0
blue - double – blue value for colour in range 0-1.0



Example Code:


--[[  ------------------ MarkContourNodes ----------------------------    
   |  
   |  Insert a marker at each node on the passed contour  
   |  
  ]]  
  function MarkContourNodes(contour, layer)  
    local num_spans = 0  
    local ctr_pos = contour:GetHeadPosition()     
    while ctr_pos ~= nil do        
      local span  
      span, ctr_pos = contour:GetNext(ctr_pos)        -- create a marker at start of span  
      local marker = CadMarker("V:" .. num_spans, span.StartPoint2D, 3)        
      layer:AddObject(marker, true)        
      num_spans = num_spans + 1;     
    end -- while end
   -- if contour was open mark last point     
    if contour.IsOpen then  
       local marker = CadMarker("V:" .. num_spans, contour.EndPoint2D, 3)        
       layer:AddObject(marker, true)     
    end -- if end
  end -- function end 


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