Shortest rotation distance math

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Shortest rotation distance math

Postby Battwell » Mon Jul 23, 2018 9:48 am

Last steps of my tool changer code to sort.
Been racking my old brain to work out best math to work out shortest distance math with roll over.
Rotary tool rack with 6 tools
Eg tool 2 to tool 6
6-2 =4 steps
But it’s quicker to reverse direction and go 2-1-6 which is only 3 steps.
Uc300eth on router and mill.
UK uccnc powered machine sales. https://cncrouter.uk/atc-cnc-routers.htm
Automateanything/duzzit cnc/mercury cnc
Battwell
 
Posts: 819
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk

Re: Shortest rotation distance math

Postby spumco » Mon Jul 23, 2018 10:33 am

Some sort of if-then with variables?

Position X + Position Y = #A
Position X - Position Y = #B

If #A > B, then CW, else CCW

No, that won't work with rollover unless you assign a value table to each combination. Like 1 to 2 = 1, 1 to 6 = 1, 1 to 5 = 2, etc.

Hmm. Post when you get it sorted 'cause now I'm curious.
spumco
 
Posts: 306
Joined: Mon Oct 03, 2016 10:10 pm

Re: Shortest rotation distance math

Postby Battwell » Mon Jul 23, 2018 2:41 pm

Me and my son brain stormed it
Working perfect
Il post the code later
Uc300eth on router and mill.
UK uccnc powered machine sales. https://cncrouter.uk/atc-cnc-routers.htm
Automateanything/duzzit cnc/mercury cnc
Battwell
 
Posts: 819
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk


Return to Macros

Who is online

Users browsing this forum: No registered users and 18 guests

cron