Creating a text object in a gadget

This section is for general discussion about Gadgets
Post Reply
User avatar
dealguy11
Vectric Wizard
Posts: 1505
Joined: Tue Sep 22, 2009 9:52 pm
Model of CNC Machine: Anderson Selexx 510
Location: Henryville, PA
Contact:

Creating a text object in a gadget

Post by dealguy11 »

I need to include the ability to create text in a gadget. Specifically what I'm trying to do is something like Paul RownTree's CSV to 2D gadget to create both geometry and text in an Aspire file. The purpose of the text is to serve as a label for a set of vectors which can then be grouped together and nested and will appear in the printout of each sheet of the job. The text will allow the CNC operator to figure out the identity of each group (in this case, an MDF door) and put a label on the finished product.

On page 55 of the Vectric LUA documentation, it includes the following sentence for the CadObject class: "The objects derived from CadObject can include polylines, groups, text, bitmaps, toolpath previews etc." There is nowhere else in the documentation that references how you would create a text object.

Has anyone done this?f

Note - if this isn't possible, I can continue to use the Plate Production feature of Aspire to get the text into the file, which is what I do today, but would love to eliminate this step.
Steve Godding
D&S Artistic Woodworking http://www.dsartisticwood.com

gregk
Vectric Staff
Posts: 91
Joined: Mon Mar 05, 2018 12:34 pm
Model of CNC Machine: None

Re: Creating a text object in a gadget

Post by gregk »

Dear Steve,

Since you need the text only for the purpose of labelling, I would try using the CadMarker (page 63 in the Vectric LUA documentation).

I hope this helps,
Greg K

User avatar
dealguy11
Vectric Wizard
Posts: 1505
Joined: Tue Sep 22, 2009 9:52 pm
Model of CNC Machine: Anderson Selexx 510
Location: Henryville, PA
Contact:

Re: Creating a text object in a gadget

Post by dealguy11 »

Ok, thanks. Just to clarify. Since this is described as not selectable, can it be nested?
Steve Godding
D&S Artistic Woodworking http://www.dsartisticwood.com

gregk
Vectric Staff
Posts: 91
Joined: Mon Mar 05, 2018 12:34 pm
Model of CNC Machine: None

Re: Creating a text object in a gadget

Post by gregk »

Yes, markers cannot be selected and therefore nested. If the geometry is only being imported and then nested, there still may be a solution.
During the import the gadget can create both markers and geometry. Assuming there is a one label per imported part, you could use :SetInt() or :SetString() method (page 57-58) to store a "part id" - the same for the marker and object it refers to.
When the geometry is nested, each instance will have that parameter set as well. Then you would need to have another gadget that would run after nesting. This gadget would then locate each marker on the default sheet, read its "part id"
and then find each nested part that have the same "part id". After that it is only the question of placing a copy of that marker in some relation to the nested part.

Greg K

zoner
Posts: 18
Joined: Wed Sep 11, 2013 6:41 pm
Model of CNC Machine: Self design - 5' x 10' x 1'

Re: Creating a text object in a gadget

Post by zoner »

I have the same need ... adding text to identify what part was read and built ...

I feed a CSV file from Excel which discribes a full wall with sections of angled panels ... the file contains the size of each panel.

I need to add the name of the part (which is in the CSV file) to the drawing to identify it ... I normally group the text with the part ...

Tried the markers but since you cannot select them they are useless ...

Where is the CreateText API ?

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

Re: Creating a text object in a gadget

Post by Adrian »

zoner wrote: Where is the CreateText API ?
There isn't an API for every part of Cut2D/VCarve/Aspire. Some things you need to create your own code.

Why is not being able to select the markers a problem?

zoner
Posts: 18
Joined: Wed Sep 11, 2013 6:41 pm
Model of CNC Machine: Self design - 5' x 10' x 1'

Re: Creating a text object in a gadget

Post by zoner »

Because I need to associate it to the panel shape and move both on sheets one per sheet ... the wall is about 8 feet high and 50 feet wide ... each acoustic panel is maximum 4 feet wide and 8 feet high ... so the wall has about 20 panels ... each one a specific size and shape ... so attaching a label to the panel shape is mandatory ...

User avatar
jimandi5000
Vectric Wizard
Posts: 330
Joined: Wed Mar 11, 2015 6:50 pm
Model of CNC Machine: Home Made 60 x 120
Location: North Houston Tx.

Re: Creating a text object in a gadget

Post by jimandi5000 »

zoner wrote:I have the same need ... adding text to identify what part was read and built ...

I feed a CSV file from Excel which discribes a full wall with sections of angled panels ... the file contains the size of each panel.

I need to add the name of the part (which is in the CSV file) to the drawing to identify it ... I normally group the text with the part ...

Tried the markers but since you cannot select them they are useless ...

Where is the CreateText API ?

Hi Zoner,

I have a Gadget that puts real vector based letters and numbers on the drawing. I use them on my CNC mill to laser burn part ID numbers on my parts. See the image and let me know if this is what you are looking for?
Attachments
Finger1.jpg
Thanks,
Jim

zoner
Posts: 18
Joined: Wed Sep 11, 2013 6:41 pm
Model of CNC Machine: Self design - 5' x 10' x 1'

Re: Creating a text object in a gadget

Post by zoner »

Hi Jim,

Yes I would be interested to look at the code and probably use it in my own to add text to panel shapes which could be "selected" automatically (meaning by code) and then grouped. Is it formatted as a function call ? position, text and size ? How can we go about it ?

Mike.

User avatar
jimandi5000
Vectric Wizard
Posts: 330
Joined: Wed Mar 11, 2015 6:50 pm
Model of CNC Machine: Home Made 60 x 120
Location: North Houston Tx.

Re: Creating a text object in a gadget

Post by jimandi5000 »

Hi Mike,
Here is where I posted the code.

https://forum.vectric.com/viewtopic.php?f=51&t=33272

Have a look and I would live to see how you use it.
Thanks,
Jim

zoner
Posts: 18
Joined: Wed Sep 11, 2013 6:41 pm
Model of CNC Machine: Self design - 5' x 10' x 1'

Re: Creating a text object in a gadget

Post by zoner »

I just got the code ... sorry for the delay ... life ...

I looked at the code and it seems fine, passing it the layer name and all ... super cool !

I will transform it a tad ... to make it a luax file ... I'll post it on the other link you gave me when done ? Having a code library is helpfull sometimes lol

Why all on one lines separated with semi-comas ? I usually document everything ... at the end of a line lol will be difficult to keep it like that lol I understand the appealing view of one line per letter though ... will think it through, probably render the said line to a function call ... and keep it a one liner per letter ...

But great many thanks for the code ! I will save a lot of time with this ... no manual entry and easy grouping from code ... the object and its label ... one shot ! So again, thanks !

Mike.

Post Reply