CadContour: Difference between revisions

From SDK
Jump to navigation Jump to search
No edit summary
 
(One intermediate revision by the same user not shown)
Line 21: Line 21:
::''point (Point2D)  The point where to place the toolpath tab''
::''point (Point2D)  The point where to place the toolpath tab''


== Example ==
<nowiki>
-- VECTRIC LUA SCRIPT
-- Copyright 2013 Vectric Ltd.
-- Gadgets are an entirely optional add-in to Vectric's core software products.
-- They are provided 'as-is', without any express or implied warranty, and you make use of them entirely at your own risk.
-- In no event will the author(s) or Vectric Ltd. be held liable for any damages arising from their use.
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it freely,
-- subject to the following restrictions:
-- 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
-- 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-- 3. This notice may not be removed or altered from any source distribution.
require("mobdebug").start()
require "strict"
--[[  ------------------------ main --------------------------------------------------
|
|  Entry point for script.  Adds a tab to selected contour
|
]]
function main(script_path)
    -- Check we have a job loaded
    local job = VectricJob()
    if not job.Exists then
      DisplayMessageBox("No job open.")
      return false
    end
-- get selected contour
local selection = job.Selection
  local cadcontour = selection:GetAt(selection:GetHeadPosition())
 
  -- add tab
  local point = Point2D(2.5,0.3)
  cadcontour:InsertToolpathTabAtPoint(point)
    return true
end
  </nowiki>




[[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]

Latest revision as of 10:59, 18 November 2024

Back.jpg

This object is derived from CadObject and represents a single vector within the job. A CadContour holds a Contour object which contains the actual data for the vector shape. A CadContour is created from a Contour object using the CreateCadContour() method. To access the Contour data from a CadContour object, use the :GetContour() method from the base CadObject class.


Properties

All the properties for this object are documented in the CadObject base class


Methods

Note: This object inherits all documented methods from the CadObject base class with the following additions


:InsertToolpathTabAtPoint(Point2D point)

This method inserts a toolpath tab at the point on the CadContour closest to the specified point.

Returns: a ToolpathTab object.

point (Point2D) The point where to place the toolpath tab


Example


-- VECTRIC LUA SCRIPT
-- Copyright 2013 Vectric Ltd.

-- Gadgets are an entirely optional add-in to Vectric's core software products. 
-- They are provided 'as-is', without any express or implied warranty, and you make use of them entirely at your own risk.
-- In no event will the author(s) or Vectric Ltd. be held liable for any damages arising from their use.

-- Permission is granted to anyone to use this software for any purpose, 
-- including commercial applications, and to alter it and redistribute it freely, 
-- subject to the following restrictions:

-- 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
-- 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-- 3. This notice may not be removed or altered from any source distribution.

require("mobdebug").start()
require "strict"

--[[  ------------------------ main --------------------------------------------------
|
|  Entry point for script.  Adds a tab to selected contour
|
]]

function main(script_path)

    -- Check we have a job loaded
    local job = VectricJob()

    if not job.Exists then
       DisplayMessageBox("No job open.")
       return false
    end
		
	-- get selected contour
	local selection = job.Selection
  local cadcontour = selection:GetAt(selection:GetHeadPosition())
  
  -- add tab
  local point = Point2D(2.5,0.3)
  cadcontour:InsertToolpathTabAtPoint(point)
	
    return true
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