How do you Group Objects on a Layer

This section is for general discussion about Gadgets

How do you Group Objects on a Layer

Postby jimandi5000 » Wed Nov 21, 2018 3:56 pm

Hi All,

I am looking to Group objects on a layer.

here is my code:

-- VECTRIC LUA SCRIPT
require "strict"
--Global variables
-- ==============================================================================
function Polar2D(pt, ang, dis)
local y_ = dis * math.sin(math.rad(ang))
local x_ = dis * math.cos(math.rad(ang))
return Point2D((pt.X + x_), (pt.Y + y_))
end -- function end
-- ==============================================================================
--function main(script_path)
function main()
local lay = "A"
local job = VectricJob()
if not job.Exists then
DisplayMessageBox("No job loaded")
return false;
end
local pt1 = Point2D(3.0,3.0)
local pt2 = Polar2D(pt1, 0, 12)
local pt3 = Polar2D(pt2, 90, 22)
local pt4 = Polar2D(pt3, 180, 12)
local pt5 = Polar2D(pt1, 45, 7)
local pt6 = Polar2D(pt5, 90, 1)
local pt7 = Polar2D(pt5, 180, 1)
local layer = job.LayerManager:GetLayerWithName(lay)
local line = Contour(0.0)
line:AppendPoint(pt1)
line:LineTo(pt2) ; line:LineTo(pt3)
line:LineTo(pt4) ; line:LineTo(pt1)
layer:AddObject(CreateCadContour(line), true)

line = Contour(0.0)
line:AppendPoint(pt6)
line:ArcTo(pt7, 1.0)
line:ArcTo(pt6, 1.0)
layer:AddObject(CreateCadContour(line), true)

-- Group all on Layer "A"

job:Refresh2DView()
return true
end
Thanks,
Jim
User avatar
jimandi5000
 
Posts: 18
Joined: Wed Mar 11, 2015 6:50 pm
Location: North Houston Tx.
Model of CNC Machine: Home Made 60 x 120

Re: How do you Group Objects on a Layer

Postby Adrian » Wed Nov 21, 2018 5:22 pm

Iterate through the layer and add to the group.
User avatar
Adrian
Vectric Archimage
 
Posts: 8619
Joined: Thu Nov 23, 2006 2:19 pm
Location: Surrey, UK
Model of CNC Machine: ShopBot PRS Alpha 96x48

Re: How do you Group Objects on a Layer

Postby jimandi5000 » Wed Nov 21, 2018 9:11 pm

That is what I don't know how to do.
Thanks,
Jim
User avatar
jimandi5000
 
Posts: 18
Joined: Wed Mar 11, 2015 6:50 pm
Location: North Houston Tx.
Model of CNC Machine: Home Made 60 x 120

Re: How do you Group Objects on a Layer

Postby Adrian » Wed Nov 21, 2018 9:27 pm

Have you got the SDK? All the info you need is in the PDF and example scripts.
User avatar
Adrian
Vectric Archimage
 
Posts: 8619
Joined: Thu Nov 23, 2006 2:19 pm
Location: Surrey, UK
Model of CNC Machine: ShopBot PRS Alpha 96x48

Re: How do you Group Objects on a Layer

Postby jimandi5000 » Wed Nov 21, 2018 10:08 pm

Hi Adrian,

I have been looking at it... I do not see the CAD Object Model hierarchy in the PDF. Not knowing the structure, I am just doing it by trail and error. I have produced a lot of AutoCAD (Lsp, Visual Lsp & C++) programs and AutoDesk provides a CAD Object Model in their SDK.

This is what I am thinking:
From the most Top level to Bottom

1. Job - You can only have one if the Job has been setup. Not sure what is above this.
2. Layer - 0 - 256 (not 100% sure)
3. Objects (line, arc, polyline, text, etc) - object are made only on layers
4. Object linking (Group, Toolpaths) - Groups and Toolpaths are linking or linked to objects and or Layers

Is this correct?

Do you know where I can get a layout?
Thanks,
Jim
User avatar
jimandi5000
 
Posts: 18
Joined: Wed Mar 11, 2015 6:50 pm
Location: North Houston Tx.
Model of CNC Machine: Home Made 60 x 120

Re: How do you Group Objects on a Layer

Postby jimandi5000 » Mon Nov 26, 2018 4:40 am

I have done it!!! :D
Thanks,
Jim
User avatar
jimandi5000
 
Posts: 18
Joined: Wed Mar 11, 2015 6:50 pm
Location: North Houston Tx.
Model of CNC Machine: Home Made 60 x 120


Return to Gadgets - General

Who is online

Users browsing this forum: No registered users and 4 guests