Layer Gadget

This section is for general discussion about Gadgets

Layer Gadget

Postby GrainDesign » Wed Nov 08, 2017 8:02 pm

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
GrainDesign
Vectric Apprentice
 
Posts: 3
Joined: Thu Jun 16, 2016 8:05 am
Model of CNC Machine: Ascent pro

Re: Layer Gadget

Postby Adrian » Wed Nov 08, 2017 9:48 pm

Colour (and Color) is a read/write property of CadLayer. Page 47 in the SDK documentation.
User avatar
Adrian
Vectric Archimage
 
Posts: 7404
Joined: Thu Nov 23, 2006 2:19 pm
Location: Surrey, UK
Model of CNC Machine: ShopBot PRS Alpha 96x48

Re: Layer Gadget

Postby GrainDesign » Thu Nov 09, 2017 1:26 am

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.
GrainDesign
Vectric Apprentice
 
Posts: 3
Joined: Thu Jun 16, 2016 8:05 am
Model of CNC Machine: Ascent pro

Re: Layer Gadget

Postby Adrian » Thu Nov 09, 2017 8:00 pm

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
User avatar
Adrian
Vectric Archimage
 
Posts: 7404
Joined: Thu Nov 23, 2006 2:19 pm
Location: Surrey, UK
Model of CNC Machine: ShopBot PRS Alpha 96x48

Re: Layer Gadget

Postby GrainDesign » Fri Nov 10, 2017 10:30 pm

Thanks Adrian

That worked,
I was very close with it but just had it the coding slightly wrong.
GrainDesign
Vectric Apprentice
 
Posts: 3
Joined: Thu Jun 16, 2016 8:05 am
Model of CNC Machine: Ascent pro


Return to Gadgets - General

Who is online

Users browsing this forum: No registered users and 0 guests