VectricJob: Difference between revisions

From SDK
Jump to navigation Jump to search
No edit summary
No edit summary
Line 249: Line 249:


Returns (bool) true if this is a wrapped model   
Returns (bool) true if this is a wrapped model   
=== :MoveObjectToSheet(CadObject object, UUID sheet_id) ===
Moves the passed object to the sheet with the passed id. For details of how to access the sheet ids see CadSheetManager. 





Revision as of 06:26, 28 March 2022

Back.jpg

This is the main object a script writer will interact with and represents the currently open job (file) within the application. There are members of the object which will tell you if there is an existing job open and to allow you to create a new job.

Properties

.Exists

Read Only: Returns (bool) true if there is an existing job open


.DocumentVariables

Read Only: Returns the DocumentVariableList for the job.

The variable list allows for user defined values to be used in formulas.


.Height

Read Only: Returns (double) height of the job along y (same as YLength)


.IsAspire

Read Only: Returns (bool) true if the script is running inside Aspire.


.IsBetaBuild

Read Only: Returns (bool) true if this is a Beta build rather than a release build


.InInches

Read Only: Returns (bool) true if the current units are inches


.InMM

Read Only: Returns (bool) true if the current units are mm


.Job Parameters

Read Only: Returns the utParameterList for the job. The parameter list allows scripts to store persistent data with the job.


.LayerManager

Read Only: Returns the CadLayerManager for the job. This manages all the layers which in turn hold all the vector objects in the job


.MinX

Read Only: Returns (double) X coordinate of bottom left corner of job


.MinY

Read Only: Returns (double) Y coordinate of bottom left corner of job


.Name

Read Only: Returns (string) the name of the current job WITHOUT the file extension e.g. test not test.crv


.PostProcessorParameters

Read Only: Returns the utParameterList for the last run of a post processor.

This will hold information such as the PostP used, the tools used and the actual toolpath files output.


.Selection

Read Only: Returns the SelectionList for the currently selected vectors in the job.

.SheetManager 

R/O - returns the CadSheetManager for the job. This manages all the sheets in the job 

.Width

Read Only: Returns (double) width of the job along x (same as XLength)


.XLength

Read Only: Returns (double) length of the job along x (same as XLength)


.YLength

Read Only: Returns (double) length of the job along Y (same as Height)


Methods

:ClearClipboard()

Clear any data on the clipboard


:CreateHorizontalGuide( double y_value, bool locked)

Create a horizontal guide

y_value (double) y value for guide locked (bool) and if true guide is locked

:CopyToClipboard( string text)

Copies passed text to clipboard.

Returns (bool) true if copied to clipboard OK else false.

text (string) text to put on clipboard


:CreateVerticalGuide( double x_value, bool locked)

Create a vertical guide

x_value (double) x value for guide
locked (bool) if true guide is locked


:DisplayToolpathPreviewForm()

Display the toolpath preview form for simulation


:ExportSelectionToEps(string pathname)

Exports selected vectors to passed path as an EPS file.

Returns (bool) true if data exported OK else false.

pathname (string) path to file


:ExportSelectionToDxf( string pathname)

Exports selected vectors to passed path as a DXF file.

Returns (bool) true if data exported OK else false.

pathname (string) path to file


:ExportSelectionToSvg( string pathname)

Exports selected vectors to passed path as a SVG file.

Returns (bool) true if data exported OK else false.

pathname (string) path to file


:ExportDocumentVariables( string pathname)

Exports the job’s DocumentVariableList to passed path as an INI file.

pathname (string) path to file


:GetBuildVersion()

Returns application internal build verion same for Aspire and VCarve Pro

e.g. 7.004 for Aspire 4.004 which matches VCarve Pro 7.004  


:GetBounds()

Returns the 2D bounding box for the drawing area as a Box2D


:GetAppVersion()

Returns application version number as a double

e.g 4.004 for Aspire V4.0  


:GetWrapDiameter()

Returns wrap diameter for a wrapped model


:GroupSelection()

Returns (bool) true if the current selection could be grouped


:GuidesVisible()

Returns (bool) true if guides are visible else false


:ImportBitmap( string pathname)

Imports a bitmap from passed path.

Returns (bool) true if file imported OK else false.

pathname (string) path to file


:ImportDxfDwg( string pathname)

Imports a dxf or dwg file from passed path.

Returns (bool) true if file imported OK else false.

pathname (string) path to file
NOTE: after data is imported it is selected.


:ImportSTLDirect( string pathname)

Directly import (without orientation form) an STL with passed path (Automatically creates a component)

Returns (bool) true if file imported OK else false. NOTE: Aspire only

pathname (string) path to file


:ImportSVG( string pathname)

Import an SVG file with the given path and creates the vectors and layers.

Returns (bool) true if the file was imported with no issues, otherwise Returns false.

pathname (string) path to file


:ImportDocumentVariables( string pathname)

Imports a DocumentVariableList from the passed path. Please note that any existing variables will be overwritten.

pathname (string) path to file


:IsWrappedModel()

Returns (bool) true if this is a wrapped model

:MoveObjectToSheet(CadObject object, UUID sheet_id) 

Moves the passed object to the sheet with the passed id. For details of how to access the sheet ids see CadSheetManager. 


:Refresh2DView()

Refreshes the 2D view, call this after you have created or modified geometry to update the 2d view


:SelectAllVectors()

Returns (bool) true if all vectors in the current job could be selected


:SetGuidesVisible(bool visible)

Set visibility of guides

visible (bool) true if guides visible else false


:SetXY_Origin(double origin, double x_offset, double y_offset)

Set the 2D origin for the job.

Returns (bool) true if origin set OK else false.

origin as to XYOrigin the four corners or the centre
x_offset (double) distance in X of specified point from 0,0
Y_offset (double) distance in Y of specified point from 0,0
NOTE: No data is moved by this call


:UnGroupSelection(bool deep_ungroup, bool preserve_orig_layers)

Returns (bool) true if the current selection could be ungroup

deep_ungroup (bool) if true ungroup Groups recursively
preserve_orig_layers (bool) if true preserve the original object layers


:WrappingXValues()

Return (bool) true if we are wrapping X values, else wrapping Y values


:WrapZOnSurface()

Returns (bool) true if z for wrap is on surface of material, else in centre


:SwitchActiveSide()

Switch the current side and make the opposite side active


:SetActiveSide(UUID side_id)

Set the current side to be that of the given UUID


:GetSideList()

Return UUID_List with the list of side UUIDs. This is useful for iterating over the sides


:GetActiveSideId()

Return the current side or sides UUID


:GetSideName(UUID side_id)

Return (string) with the name of the current side


:CopySelectionToOppositeSide()

Copy the selected vectors and components to the opposite side and flip them.


:MoveSelectionToOppositeSide()

Move the selected vectors and components to the opposite side and flip them.


:SideComponentManager(UUID side_id)

Return the ComponentManager for the side which has the given UUID.

Note: If you just require the component manager of the current side, you can just carry on using .ComponentManager


:IsSingleSided()

Return (bool) true if we have a job and it is single-sided.

Usage Example:

       local SingleSided = job.IsSingleSided
       if not SingleSided then
           DisplayMessageBox("Error: Job must be a single sided job")
           return false 
       else
           return true
       end  -- if end 


:IsDoubleSided()

Return (bool) true if we have a job and it is double-sided.

Usage Example:

 
       local DoubleSided = job.IsDoubleSided
       if not DoubleSided then
          DisplayMessageBox("Error: Job must be a double sided job")
          return false
       else
          return true
       end  -- if 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