Iterate through the group and contours in group

This section is for general discussion about Gadgets

Iterate through the group and contours in group

Postby dturk » Sun Jun 24, 2018 8:36 pm

Yesterday, I installed the Gadget SDK. In a effort to understand
the programing logic of using the Gadget SDK kit. I have tried
some of the examples in the pdf.

The first concept I wanted to understand was how the lines and contours
are structured in Aspire 9.0+. Based on the documentation the key to
understand this concept is ... "ContourGroup Programing" on page 82 of the pdf.

Using the following example in the pdf;

-- iterate through the group and contours in group
local count = 0
local num_spans = 0
local span_length = 0.0
local tolerance = 0.0001
local pos = group:GetHeadPosition()
while pos ~= nil do
local contour

contour , pos = group:GetNext(pos)
-- iterate through each span in the contour

local ctr_pos = contour:GetHeadPosition()
while ctr_pos ~= nill do
local span
span, ctr_pos = contour:GetNext(ctr_pos)
num_spans = num_spans + 1;
span_length = span_length + span:GetLength(0.0001)
end
count = count + 1
end

---
After the correct structures around the code and verifying code was
added. A vector was selected and I ran the program.

I received an error on the following line:
>> local pos = group:GetHeadPosition()

After going back and reviewing the Constructor, I tried several
different ways to define the constructor ("group").

I'm looking for any ideas.

Daryl
dturk
 
Posts: 14
Joined: Mon Dec 27, 2010 2:22 pm
Location: Land O Lakes, Fl
Model of CNC Machine: Legacy Arty58 / Shark Pro

Re: Iterate through the group and contours in group

Postby Adrian » Sun Jun 24, 2018 9:27 pm

Look at the Contour_Creation_Example script that comes with the SDK.
User avatar
Adrian
Vectric Archimage
 
Posts: 8342
Joined: Thu Nov 23, 2006 2:19 pm
Location: Surrey, UK
Model of CNC Machine: ShopBot PRS Alpha 96x48


Return to Gadgets - General

Who is online

Users browsing this forum: No registered users and 2 guests