gadgets

This section is for general discussion about Gadgets
Post Reply
Mikeyd
Posts: 5
Joined: Wed Dec 30, 2020 9:59 pm
Model of CNC Machine: Cobot 15000

gadgets

Post by Mikeyd »

hello i would like to create a gadget for: selecting an imported file, and rotate 90 ° ,and then set it back to x 0 y 0. is there anyone who can help me i'm stuck on the point rotation and set it back on x0 y0

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

Re: gadgets

Post by Adrian »

You've asked this question in three different areas which can make it pretty tricky to keep track of replies etc. Better to ask once and wait for replies. There aren't many people creating gadgets so responses aren't as fast as other parts of the forum.

Assuming it is vectors you want to rotate you need to look at the Transform method in the SDK documentation.

Mikeyd
Posts: 5
Joined: Wed Dec 30, 2020 9:59 pm
Model of CNC Machine: Cobot 15000

Re: gadgets

Post by Mikeyd »

Hello Adrian,

First of all: best wishes for 2021! :)

Thanks for your help by pointing in the direction of the SDK documentation.
Together with my brother-in-law, we created some code, which already works nice for the rotation of the vectors/objects.
However, the re-setting of the x / y axis does not seem to do anything.

Here is the full code:

Code: Select all

-- VECTRIC LUA SCRIPT
function main()
	job = VectricJob()
	if not job.Exists then
		DisplayMessageBox("No job loaded")
		return false;
	end

	local selection = job.Selection
	-- eerst roteren
	if selection.IsEmpty then
		MessageBox("Please select one or more vectors to label")
		return false
	else
		--MessageBox(tostring(selection.Count))
		if selection:CanTransform(2) then
			local xform = RotationMatrix2D(Point2D(0,0), 90)
			selection:Transform(xform)
		end
	end
	-- dan verschuiven
	local selection2 = job.Selection
	if selection.IsEmpty then
		MessageBox("Please select one or more vectors to label")
		return false
	else
		--MessageBox(tostring(selection.Count))
		if selection:CanTransform(1) then
			local vec = Vector2D(0.0, 0.0)
			local xform2 = TranslationMatrix2D(vec)
			selection:Transform(xform2)
		end	
	end
	job:Refresh2DView()
	return true
end
First of all: are we right to use the TranslationMatrix2D please?
If so, have you any more suggestions on what we should change please?
The exact action I want to simulate from Vcarve Pro is 'transform objects' -> 'move selected objects' -> 'absolute, x: 0.0 and y:0.0'

Have a great day!

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

Re: gadgets

Post by Adrian »

The translation matrix isn't an absolute value it's a distance to move. So you need to create your input to TransformMatrix2D as the distance in XY you need to move the bottom left (presuming that's what you want to be at 0,0) of your selected vector to 0,0.

Mikeyd
Posts: 5
Joined: Wed Dec 30, 2020 9:59 pm
Model of CNC Machine: Cobot 15000

Re: gadgets

Post by Mikeyd »

is there anyone who can and wants to help me write the piece of code for moving between x0 and y 0? I can't find how to do it
thank you in advance

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

Re: gadgets

Post by Rcnewcomb »

is there anyone who can and wants to help me write the piece of code for moving between x0 and y 0? I can't find how to do it thank you in advance
Can you explain a bit more what you want to do?
Is it just swapping X for Y, and Y for X? If so, that is very easy to do in the post processor.
- Randall Newcomb
10 fingers in, 10 fingers out
another good day in the shop

Mikeyd
Posts: 5
Joined: Wed Dec 30, 2020 9:59 pm
Model of CNC Machine: Cobot 15000

Re: gadgets

Post by Mikeyd »

hello, I use the cabmaker 32 program to draw cabinets. the program automatically creates the dxf files per part. but these must be rotated sometimes and not at other times before they can be processed on the machine. I work on my machine with pneumatic stops x 0 y 0

That's why I would like to have a gadget to prepare the files with a shortcut for g code. This is quite a job now, a lot of clicks and therefore a chance of errors.

User avatar
sharkcutup
Vectric Wizard
Posts: 2835
Joined: Sat Mar 26, 2016 3:48 pm
Model of CNC Machine: Shark HD3 Pro Extended Bed with Spindle
Location: U.S.A.

Re: gadgets

Post by sharkcutup »

I have taken a look at your code, copied it and installed it into V-Carve Pro.
Created a panel vector 10" Wide (x) by 14" Height (y)
Job setup is with x 0 y 0 at the center of the material board 18" wide (x) by 36" height

Panel Vector is located in upper right Quadrant Longest side Vertically Oreintated

When I use your gadget is rotates the vector panel 90 degrees and then moves the Vector panel to another Quadrant

Is it a corner of the of the vector panel you want to move to x 0 y0 datum location? If so then put the corner of the panel vector at he x0 y0 datum location then use gadget. The Gadget will move the Vector Panel Around the x0 y0 datum rotating the vector panel 90 degres first then the Vector Panel will move to another quadrant.

Sharkcutup
V-Carve Pro Tips, Gadget Tips & Videos
YouTube Channel - Sharkcutup CNC
V-Carve Pro 11.554

User avatar
sharkcutup
Vectric Wizard
Posts: 2835
Joined: Sat Mar 26, 2016 3:48 pm
Model of CNC Machine: Shark HD3 Pro Extended Bed with Spindle
Location: U.S.A.

Re: gadgets

Post by sharkcutup »

Are you still needing help with that gadget creation?

Sharkcutup
V-Carve Pro Tips, Gadget Tips & Videos
YouTube Channel - Sharkcutup CNC
V-Carve Pro 11.554

User avatar
sharkcutup
Vectric Wizard
Posts: 2835
Joined: Sat Mar 26, 2016 3:48 pm
Model of CNC Machine: Shark HD3 Pro Extended Bed with Spindle
Location: U.S.A.

Re: gadgets

Post by sharkcutup »

Evidently the OP is still lost in 2021. Probably adjusting his time warp machine to get back to the present (2024).

Oops!!! Just noticed it was an old post! Sorry!

Still awaiting a reply though! It would be Nice to know if the OP was successful in getting his gadget developed or Not.

Sharkcutup

Sharkcutup
V-Carve Pro Tips, Gadget Tips & Videos
YouTube Channel - Sharkcutup CNC
V-Carve Pro 11.554

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

Re: gadgets

Post by Adrian »

His initial post was in 2021 but he posted again at the end of Jan this year and a couple of days ago so you're not wrong in asking if he needs help.

User avatar
sharkcutup
Vectric Wizard
Posts: 2835
Joined: Sat Mar 26, 2016 3:48 pm
Model of CNC Machine: Shark HD3 Pro Extended Bed with Spindle
Location: U.S.A.

Re: gadgets

Post by sharkcutup »

Well evidently the Op has given up on getting his gadget created.

It is ashame too because I may have created a gadget that might work for his intended operation.

Sharkcutup
V-Carve Pro Tips, Gadget Tips & Videos
YouTube Channel - Sharkcutup CNC
V-Carve Pro 11.554

Post Reply