Join Open Vectors

This section is for general discussion about Gadgets
Post Reply
jakumins
Vectric Apprentice
Posts: 5
Joined: Tue Jun 20, 2017 1:02 am
Model of CNC Machine: Shop Bot

Join Open Vectors

Post by jakumins »

I was wondering if anyone has created a gadget to join open vectors or knows if there is a lua function to do so?

User avatar
CrowsWW
Vectric Craftsman
Posts: 150
Joined: Wed Jun 27, 2012 7:10 pm
Model of CNC Machine: ShopSabre 4896
Location: Palmer, Alaska USA

Re: Join Open Vectors

Post by CrowsWW »

if you have Vcarve Pro it is on the Edit Objects.

see picture I put a red line around the icon.
Attachments
New Picture (2).jpg
Troy Crow
Crow's Woodwork's
I have a day job to support my wood habit!

jakumins
Vectric Apprentice
Posts: 5
Joined: Tue Jun 20, 2017 1:02 am
Model of CNC Machine: Shop Bot

Re: Join Open Vectors

Post by jakumins »

Yes I know how to do it manually, but I want aspire to do it for me via a gadget.

jakumins
Vectric Apprentice
Posts: 5
Joined: Tue Jun 20, 2017 1:02 am
Model of CNC Machine: Shop Bot

Re: Join Open Vectors

Post by jakumins »

I guess let me clarify, I am looking to make a gadget that selects all vectors on a layer, joins the vectors then selects the next layer....and so on.

User avatar
Rcnewcomb
Vectric Wizard
Posts: 5134
Joined: Fri Nov 04, 2005 5:54 am
Model of CNC Machine: 24x36 GCnC/WinCNC with ATC
Location: San Jose, California, USA
Contact:

Re: Join Open Vectors

Post by Rcnewcomb »

You would need to write your own based on your rules for how vectors should be joined.

For example, The vectors may be joined, but not be what you had in mind.
Unjoined.JPG
JoinedMess.JPG
- Randall Newcomb
10 fingers in, 10 fingers out
another good day in the shop

jakumins
Vectric Apprentice
Posts: 5
Joined: Tue Jun 20, 2017 1:02 am
Model of CNC Machine: Shop Bot

Re: Join Open Vectors

Post by jakumins »

The shapes I would be joining would be simple closed (not recogonized by aspire as closed) shapes, with a tolerance less than 0.01 in.

My question basically is what lua script function can I use to join the vectors?

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

Re: Join Open Vectors

Post by Adrian »

There isn't one function that will do it. As Randall says you have to write code that uses a series of different functions to do it even if all you want to do is what you describe. Basically working through the contours, finding the gaps, appending onto a new vector with the points adjust to be the same etc. That's the only way I know to do it.

I use scripts to automate the Aspire UI itself when I want to do something like that as it's quicker and easier than creating the LUA code.

jakumins
Vectric Apprentice
Posts: 5
Joined: Tue Jun 20, 2017 1:02 am
Model of CNC Machine: Shop Bot

Re: Join Open Vectors

Post by jakumins »

Thanks Adrian!

That's kind of what I was thinking, I was just hoping there was an easier way.

reggieaj
Posts: 8
Joined: Sat Jun 18, 2022 11:09 pm
Model of CNC Machine: X-Carve

Re: Join Open Vectors

Post by reggieaj »

Adrian,

That's the approach I'll take.
Since the elements I want to join will always be connected unless they are closed objects (such as holes) within the perimeter of the the objects that need joining, I expect the following algorithm would work:

Create new empty contour
Add 1st encountered non-closed element to the contour
For each remaining non-closed element
Append the next element to the end of the contour

This assumes appending to a contour results in a join. And I would expect traversing the elements should show that they are encountered in adjacent/connected order.

I'm going to try to modify the SelectVectorsOnLayer function to accomplish an overall join of the non-closed but connected elements on a layer.

What say yee?

Post Reply