CadObject

From SDK
Jump to navigation Jump to search
Back.jpg

This object is the base class for all the different types of objects which can appear on a layer within the application. CadObject is derived from the Object class which has only one method (ClassName). The objects derived from CadObject can include polylines, groups, text, bitmaps, toolpath previews etc. A huge variety of named parameters can be associated with every object within the program and accessed by scripts.

Properties

.ClassName

Interaction: Read Only

Returns: (string) the Returns the name of the class within the application that the object represents.

Values for this property include (Note: there are many more): 
vcCadBitmap 
vcCadContour 
vcCadObjectGroup

.Id

Interaction: Read and Write

Returns:(luaUUID) The unique identifier for this object (It is EXTREMELY important that you do not set two different objects to have the same id! )


.IsBitmap

Interaction: Read Only

Returns: (bool) true if this object is a bitmap or derived from a bitmap


.IsSelected

Interaction: Read Only

Returns: (bool) true if this object is selected. The selected state is set when an object is added to the jobs selection list.


.IsVisible

Interaction: Read and Write

Returns: (bool) Get or Set the visibility state for an object. Normally the visibility of objects within the application is controlled via its layer. Be very careful not to create invisible objects from scripts which the user cannot then make visible.


.IsLocked

Interaction: Read and Write

Returns: (bool) Get or Set the locked state for an object. Normally the locked state of objects within the application is controlled via its layer. Be very careful not to create locked objects from scripts which the user cannot then make unlocked.


.LayerId

Interaction: Read Only

Returns: (luaUUID) Id of layer this object belongs to. This cannot not be modified directly. To add objects to layers or move them between layers the methods of CadLayer must be used.


.RawId

Interaction: Read Only

Returns: (UUID) The unique identifier for the layer of this object This cannot not be modified directly. To add objects to layers or move them between layers the methods of CadLayer must be used.


.RawLayerId

Interaction: Read and Write

Returns: (UUID) The unique identifier for the layer this object belongs to.


.SheetId

Interaction: Read Only Returns: (UUID) The id of the sheet this object is on.

To move an object to a new sheet see
VectricJob:MoveObjectToSheet.


.SideId

Interaction: Read Only

Returns: (UUID) The Id of the side which this object belongs to To compare this to another UUID, use luaUUID(object.SideId).IsEqual(my_other_id)

Methods

:CanTransform( integer flags)

Returns: (bool) true if object can be transformed. The value of flag is made up by combining the following values:

  1 = Move
  2 = Rotate
  4 = Mirror
  8 = Scale Symetric
 16 = Scale Asymetric
  
  Note: ''Flags (integer) value indicating the type of valid transform being queried

:Clone()

Returns: a new copy of this object, with all new id?s. The returned object is not on a layer so is not yet part of the job.


:GetBoundingBox()

Returns: (Box2D) representing the 2d bounds of this object


:GetContour()

Returns: the Contour representation for this object (Note: not all objects will have a contour representation.)

Example Code: a grouped object will return nil for this call.


:InvalidateBounds()

Invalidates the cached bounding box for this object. This should be called if you modify the raw data for the object.


:SetLayer( CadLayer layer)

Adds this object to the passed layer

layer (CadLayer) layer this object should belong to


:Transform( Matrix2D matrix)

Transform the object using the passed transformation matrix. The transformation matrix can move (translate), scale or rotate or a combination of all 3.

matrix (Matrix2D) the transformation matrix to apply to the object


:GetBool( string parameter_name, bool default_value, bool create_if_not_exist)

Returns: (bool) flag (true or false) with the passed name, if no value with passed name Returns passed default value parameter_name (string) the name of the parameter default_value(bool) the value which will be returned if there is no existing value stored create_if_not_exist(bool) if true the default value will be stored in list if no existing value


:GetDouble( string parameter_name, double default_value, bool create_if_not_exist)

Returns: (double) with the passed name, if no value with passed name Returns passed default value parameter_name (string) the name of the parameter default_value(double) the value which will be returned if there is no existing value stored create_if_not_exist(bool) if true the default value will be stored in list if no existing value


:GetInt( string parameter_name, integer default_value, bool create_if_not_exist)

Returns: (integer) with the passed name, if no value with passed name Returns passed default value parameter_name (string) the name of the parameter value (integer) the value which will be returned if there is no existing value stored create_if_not_exist(bool) if true the default value will be stored in list if no existing value


:ParameterExists( string parameter_name, utParameterType type)

Returns: (bool) true if there is an existing parameter with passed name and type. parameter_name (string) the name of the parameter type (utParameterType) the type of parameter


:SetBool( string parameter_name, bool value)

Store a Boolean flag (true or false) with the passed name and value parameter_name (string) the name which will be used to store and retrieve the value value(bool) the value which will be stored in the parameter list


:SetDouble( string parameter_name, double value)

Store a double with the passed name and value parameter_name (string) the name which will be used to store and retrieve the value value(double) the value which will be stored in the parameter list


:SetInt(string parameter_name, integer value)

Store an integer with the passed name and value parameter_name (string) the name which will be used to store and retrieve the value value (integer) the value which will be stored in the parameter list


:SetString(string parameter_name, string value)

Store a string with the passed name and value parameter_name (string) the name which will be used to store and retrieve the value value (string) the value which will be stored in the parameter list


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