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.
thanks
Creating a circle with a gadget
-
- Posts: 4
- Joined: Thu Jun 16, 2016 8:05 am
- Model of CNC Machine: Ascent pro
- Adrian
- Vectric Archimage
- Posts: 14651
- 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
This is a bit of code based on an example SDK script that draws a circle using CreateCircle.
Code: Select all
-- VECTRIC LUA SCRIPT
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
end
function main()
local job = VectricJob()
if not job.Exists then
DisplayMessageBox("No job loaded")
return false;
end
local group = ContourGroup(true)
group:AddTail(CreateCircle(0,0,20,0.0,0.0))
AddGroupToJob(job, group, "Circle Example")
job:Refresh2DView()
return true
end
-
- Posts: 23
- Joined: Tue Nov 06, 2012 4:47 am
- Model of CNC Machine: Legacy Maverick 4x8, BOSS laser
- Location: Los Altos Hills, CA
Re: Creating a circle with a gadget
AddGroupToJob is not in the 10.5 SDK. How do I add the group to the job in 10.5?
-
- Posts: 23
- Joined: Tue Nov 06, 2012 4:47 am
- Model of CNC Machine: Legacy Maverick 4x8, BOSS laser
- Location: Los Altos Hills, CA
Re: Creating a circle with a gadget
Thanks! I figured it out, but am unable to delete my question.
- jimandi5000
- Vectric Wizard
- Posts: 1054
- Joined: Wed Mar 11, 2015 6:50 pm
- Model of CNC Machine: Home Made 60 x 120
- Location: North Houston Tx.
- Contact:
Re: Creating a circle with a gadget
Hi GrandDesign,GrainDesign wrote: ↑Tue Dec 05, 2017 8:49 amHi 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.
thanks
Have you looked at a SKD Wiki I built?
https://jimandi.com/SDKWiki/index.php?title=Main_Page
I have code posted to help show how to draw with Gadgets. have a look at this one: https://jimandi.com/SDKWiki/index.php?t ... w_a_Circle
Let me know if you need help.
Thanks,
Jim
Jim