Layer Gadget

This section is for general discussion about Gadgets
Post Reply
GrainDesign
Posts: 4
Joined: Thu Jun 16, 2016 8:05 am
Model of CNC Machine: Ascent pro

Layer Gadget

Post by GrainDesign »

Hi there

I have made a gadget to add layers into a job. I am wanting to know if it is possible to assign each of those layers its own colour via the script also.

If it is possible how would I go about this?

Thanks

User avatar
Adrian
Vectric Archimage
Posts: 14503
Joined: Thu Nov 23, 2006 2:19 pm
Model of CNC Machine: ShopBot PRS Alpha 96x48
Location: Surrey, UK

Re: Layer Gadget

Post by Adrian »

Colour (and Color) is a read/write property of CadLayer. Page 47 in the SDK documentation.

GrainDesign
Posts: 4
Joined: Thu Jun 16, 2016 8:05 am
Model of CNC Machine: Ascent pro

Re: Layer Gadget

Post by GrainDesign »

Thanks for you reply.

I am new to Lua and not sure how to execute this,

I have managed to get my gadget to add the Layers to vcarve but struggling to get the code right to add the colour to them.

I have tried the :SetColour() but must be doing something wrong because it just throws errors.

User avatar
Adrian
Vectric Archimage
Posts: 14503
Joined: Thu Nov 23, 2006 2:19 pm
Model of CNC Machine: ShopBot PRS Alpha 96x48
Location: Surrey, UK

Re: Layer Gadget

Post by Adrian »

The following should work for you. The first two hex bytes are red, then green then blue. So for white you would use 0xFFFFFF and for black 0x000000. The example I've given is red.

Code: Select all

local layer = job.LayerManager:GetLayerWithName("Layer 1")
layer.Color = 0xFF

GrainDesign
Posts: 4
Joined: Thu Jun 16, 2016 8:05 am
Model of CNC Machine: Ascent pro

Re: Layer Gadget

Post by GrainDesign »

Thanks Adrian

That worked,
I was very close with it but just had it the coding slightly wrong.

Post Reply