CadSheetManager: Difference between revisions
No edit summary |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 11: | Line 11: | ||
'''Read / Write''' UUID - Get the id of the active sheet. Set this value to the id of a different sheet to change the | '''Read / Write''' UUID - Get the id of the active sheet. Set this value to the id of a different sheet to change the | ||
active sheet. | active sheet. | ||
===.NumberOfSheets=== | ===.NumberOfSheets=== | ||
'''Read Only''' Integer- returns the number of sheets in the job. | '''Read Only''' Integer- returns the number of sheets in the job. | ||
'''''Example Code:''''' | |||
Returns the number of sheets | Returns the number of sheets | ||
<nowiki>function SheetCount() | <nowiki>function SheetCount() | ||
Line 51: | Line 53: | ||
::''sheet_id - UUID - the method will return the name of the sheet with this id.'' | ::''sheet_id - UUID - the method will return the name of the sheet with this id.'' | ||
'''''Example Code:''''' | |||
<nowiki>-- =====================================================]] | <nowiki>-- =====================================================]] | ||
function SheetSet(Name) -- Move focus to a named sheet | function SheetSet(Name) -- Move focus to a named sheet |
Latest revision as of 13:26, 9 May 2024
This object is responsible for managing all the sheets within the applicaon. A reference to the CadSheetManager is obtained via the SheetManager property of the VectricJob. The CadSheetManager maintains a list of all the sheet ids in the job.
Properties
.ActiveSheetId
Read / Write UUID - Get the id of the active sheet. Set this value to the id of a different sheet to change the active sheet.
.NumberOfSheets
Read Only Integer- returns the number of sheets in the job.
Example Code:
Returns the number of sheets function SheetCount() local job = VectricJob() local sheet_manager = job.SheetManager return sheet_manager.NumberOfSheets end -- function end
Methods
:CreateSheets:(integer num_sheets, UUID sheet_id)
Create num_sheets new sheets with the same properties as the sheet with id sheet_id.
- num_sheets - integer - the number of new sheets to add to the job.
- sheet_id - UUID - the id of the sheet that the new sheets should take their properties from (e.g. dimensions, Z Zero Posion etc.).
:CreateSheets:(integer num_sheets, UUID sheet_id, Box2D material_bounds)
Create num_sheets new sheets with the same properties as the sheet with id sheet_id but with width and height defined by material_bounds.
- num_sheets - integer - the number of new sheets to add to the job.
- sheet_id - UUID - the id of the sheet that the new sheets should take their properties from.
- material_bounds - Box2D - the width and height dimensions for the new sheets.
:GetSheetIds()
Returns: Lua iterator that can be used to iterate over all of the sheet ids in the job (see example below).
:GetSheetName(UUID sheet_id)
Returns: name of the sheet with the passed id as a string.
- sheet_id - UUID - the method will return the name of the sheet with this id.
Example Code:
-- =====================================================]] function SheetSet(Name) -- Move focus to a named sheet local job = VectricJob() local sheet_manager = job.SheetManager local sheet_ids = sheet_manager:GetSheetIds() for id in sheet_ids do if(sheet_manager:GetSheetName(id) == Name) then sheet_manager.ActiveSheetId = id end -- if end end -- for end end -- function end -- =====================================================]] function SheetNextSize(Name, X, Y) -- Make New Sheet to size (x, y) if X == nil then X = Milling.MaterialBlockWidth else X = X + (2 * Milling.Cal) end -- function end if Y == nil then Y = Milling.MaterialBlockHeight else Y = Y + (2 * Milling.Cal) end -- function end Milling.Sheet = Milling.Sheet + 1 local sheet_manager = Milling.job.SheetManager local sheet_ids = sheet_manager:GetSheetIds() for id in sheet_ids do if(sheet_manager:GetSheetName(id) == "Sheet 1") then sheet_manager:CreateSheets(1, id, Box2D(Point2D(0, 0), Point2D(X, Y))) end -- function end end SheetSet(Name) return true end -- function end -- =====================================================]]
References
Please Note: The base material for the contents found in this WiKi was sourced from Vectric Lua Interface for Gadgets, version 11.0, published October 18, 2011. by Vectric Ltd. Most current document from Vertric can be downloaded at Vertric Developer Information