Creating a circle with a gadget

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

Creating a circle with a gadget

Post by GrainDesign »

Hi there

I'm just learning how to create gadgets and was wondering what the easiest way of creating a circle within a gadget is.

I have tried to use the CreateCircle() global method but cant seem to get it to work it just keeps returning a nil value. (Maybe I'm doing something wrong)

Would it be easier to us the contour:ArcTo() method and us either 2 or 4 lines arced to make the circle.

any help would be appreciated.


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

Re: Creating a circle with a gadget

Post by Adrian »

This is a bit of code based on an example SDK script that draws a circle using CreateCircle.

Code: Select all


require "strict"

function AddGroupToJob(job, group, layer_name)

   local cad_object = CreateCadGroup(group); 
   local layer = job.LayerManager:GetLayerWithName(layer_name)
   layer:AddObject(cad_object, true)
   return cad_object

function main()

    local job = VectricJob()
    if not job.Exists then
       DisplayMessageBox("No job loaded")
       return false;  

   local group = ContourGroup(true)
   AddGroupToJob(job, group, "Circle Example")        

   return true


Post Reply