Welcome, Guest. Please login or register.
Did you miss your activation email?
January 23, 2018, 05:13:18 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  Mach4 General Discussion
| | |-+  Setting Motor Counts Per Unit in macro
Pages: 1 2 3 4 »   Go Down
Print
Author Topic: Setting Motor Counts Per Unit in macro  (Read 669 times)
0 Members and 2 Guests are viewing this topic.
Tony Bullard
Active Member

Offline Offline

Posts: 124


View Profile
« on: January 10, 2018, 10:58:38 AM »

Iíd like to change the Motor3 Counts Per Unit based on the diameter of work on a rotary axis. According to the Mach4 Core API these function with their parameters can be called do it.

mc.mcMotorGetInfoStruct()
mc.mcMotorSetInfoStruct()

They donít seem to be in the core in the mcLua editor.

Any suggestions of how to write a script for this?

Thanks, Tony
« Last Edit: January 10, 2018, 11:00:52 AM by Tony Bullard » Logged
joeaverage
Active Member

Offline Offline

Posts: 2,070



View Profile
« Reply #1 on: January 10, 2018, 09:34:35 PM »

Hi,
that API does not have Lua bindings, it is intended to be used in a C++ plugin.

I am not aware of any method to change the steps per unit by means of a script. I think you could write to the ini file and Mach would reflect the changes at the next
restart, clumsy but doable.

Craig
Logged

My wife left with my best friend...
     and I miss him!
Tony Bullard
Active Member

Offline Offline

Posts: 124


View Profile
« Reply #2 on: January 11, 2018, 06:52:06 AM »

Thanks Craig,

I've been working on that and then realized my code would reload the INI every time a Diameter DRO changed and that would really make a mess of things. I may let the code calculate the Counts Per Unit and then inter the counts manually on a new part change on a setup tab. 
« Last Edit: January 11, 2018, 06:56:02 AM by Tony Bullard » Logged
Mauri
Active Member

Offline Offline

Posts: 229


View Profile
« Reply #3 on: January 11, 2018, 02:22:12 PM »

Tony,
A better was would be that the Mach4 Programmers make a similar code implementation as Mach3 where the Radius of GCode represented by Z Axis would change continually the A Axis surface speed as the GCode is processed and the Z axis moves up and down. Mach3 has a Very Accurate Surface Speed change as the Z Axis Radius increases and degreases. The limits of the speed are set by the Velocity settings of the A Axis so as you go towards the center of the part close to Zero with the Z Axis Tool it will not go any faster the Velocity units/min Setting in Mach4.
This would then enable Mach4 to perform true surface speed cuts all the way through the 4 axis rotating part and hence not break or burn cutter due to incorrect speeds as the Z Axis moves in and out from the part being machined.
But to make this happen Mach4 users need to demand this Mach4 modification as my lone voice will not make it happen.
Regards,
Mauri.
Logged
Tony Bullard
Active Member

Offline Offline

Posts: 124


View Profile
« Reply #4 on: January 11, 2018, 04:22:39 PM »

Thanks Mauri,
I use a similar application in Mach3 for a plasma cutter for pipe coping where A Axis rotates a pipe and Y Axis moves the torch parallel with the A Axis center line. The Z Axis is controlled through Mach3ís THC inputs. Y is in inches and A is in degrees. To get a vector velocity (feed rate) they both have to be in the same units. Mach3 uses the radius through the angle in the line of G code to calculate the linear amount of circumference travel. Now a step ratio between the axes can be generated. Mach3 does a great job with this.

Iíd like to buy Mach4 for this machine but the lack of this radius compensation features is a real stumbling block. Another is no THC control. An easy work around that is with an Arduino variable frequency pulse generator and control panel that switches the Step and Direction signals back and forth from Mach and Arduino to control the stepper driver for THC.

I would assume the Mach programmers view these forums. I hope they are listening.
Logged
Mauri
Active Member

Offline Offline

Posts: 229


View Profile
« Reply #5 on: January 11, 2018, 05:20:32 PM »

Tony,
I have continually asked for this for the last 3 years but no one seems to care or do not think it is important to the many 4 axis users.
However to me with 2 machines with 4 Axis Rotary heads I am unable to move to Mach4 as I use long Tapered ballnose and an incorrect speed as it goes in and out of the model will break the cutter and if I take smaller cuts or lower the feed I burn it the wood and or break the cutter. So Mach3 is the only one I can use for Rotary Carving on my Router Table.
So Although I have moved the CNC Mill to Mach4, I can only use 3 Axis and as far as the Router Table that I use to Carver out many 3 and 4 axis shapes I cannot move to Mach4 even though I have all the hardware ready to convert. It is just too much work to rewire everything on the controller back and forth to use mach4 and mach3.
I also Hope someone is listenting.

Check Mach4 and THC with HiCON http://www.machsupport.com/forum/index.php/topic,32491.0.html

Regards,
Mauri.
Logged
joeaverage
Active Member

Offline Offline

Posts: 2,070



View Profile
« Reply #6 on: January 11, 2018, 09:10:41 PM »

Hi,
Mach4's API lists an 'override' axis, which if I understand correctly modifies the movement of the main axis, a THC function is suggested as an example.
I haven't used it so don't really know what can be  achieved with it but it sounds hopeful.

Currently THC is enacted by the motion controller, the regular Z axis motion pulse stream have to be broken up and more pulses inserted or alternately pulses ignored to effect
THC variation 'on top of' regular coordinated Z axis motion. The Hicon controller of Vital Systems is the only Mach4 controller that has THC support, to my knowledge.
Warp9 have been promising THC support for the ESS for best part of a year but no dice as yet.

As for programmatically adjusting the 'steps per unit' of the fly.....Access to the data structure that includes the value is not available to us via LUA but
I would presume that the 'steps per unit' value would be stored in on of Machs pound variables. If you knew which one you could manipulate it directly. It might
not be as convenient as an API nor would it be as robust, NFS makes no representation that a pound variable will retain its precise function over later builds, but
it would work. Would it be worth asking NFS what the pound variable number is?

Craig
Logged

My wife left with my best friend...
     and I miss him!
Tony Bullard
Active Member

Offline Offline

Posts: 124


View Profile
« Reply #7 on: January 12, 2018, 08:26:23 AM »


OK, I keep forgetting it is the Motion Control Plugin with hardware in Mach4 that really controls the motors. But in my case the radius compensation info would still have to be handed to the plugin from Mach. There should be tools and controls in Mach for the user to use to implement this and other rotary axis functions like surface speed. In Mauriís case with a constant surface speed (feet per minute) the rotary axis motor would change speed (rpm) with a change in radius.

It looks like we need to have Mach programmers make the controls available and the Plugin people program their controllers to use it. 
Logged
joeaverage
Active Member

Offline Offline

Posts: 2,070



View Profile
« Reply #8 on: January 12, 2018, 02:34:16 PM »

Hi,
the Mach4 Lathe profile has CSS support already. Would that not suffice?

Given that CSS is possible then it should also be possible to get it to work when using a mill profile. Either write a module/plugin using the C++ data structure
or find and use the pound variable, either is doable and the toolkit to do it is provided.

Waiting for NFS....don't hold your breath...anoxia is not pleasant.

Craig
Logged

My wife left with my best friend...
     and I miss him!
Mauri
Active Member

Offline Offline

Posts: 229


View Profile
« Reply #9 on: January 12, 2018, 05:57:35 PM »

Craig,
If we are to do this we would need your help.
Variable A Axis Velocity Degrees Per Min = Fspeed UnitPerMin in Gcode/(VariableRadiusZaxis x 4 x Pi())/360
A axis in my case is not to exceed Velocity Degrees Per Min 15900 using a 15:1 ratio on Router Table.
So at its smallest radius it must not exceed 15900.
The larger the radius the smaller the Velocity Degrees Per Min.
For example.
F2500 mm/min
Radius Z Axis = 50mm (100mm dis part)
Velocity Degrees Per Min = 1432.3945

Radius Z Axis = 4.504mm (smallest allowed to maintain 15900)
Velocity Degrees Per Min = 15900

Any lower in Radius Z Axis, then Velocity Degrees Per Min must not go any lower than 15900.
Natually a fixed F2500 is only good for about Z 25mm.

Variable A Axis Velocity Degrees Per Min = Fspeed UnitPerMin in Gcode/(VariableRadiusZaxis x 4 x Pi())/360
if Variable A Axis Velocity Degrees Per Min > 15900 then Velocity Degrees Per Min = 15900

Not sure how you could implement this.
Each Gcode Program would have different X/Y Fspeed so this must be read into the program code also The Z Axis value would also have to be read in as part of the calculation.
Then the A Axis Velocity Degrees Per Min would have to be continually changed in the Mach4 registry as this program and CNC machines progresses through the Gcode.

Can you help with this for us?

Regards,
Mauri.


Logged
Pages: 1 2 3 4 »   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!