Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Tony Bullard on January 10, 2018, 10:58:38 AM

Title: Setting Motor Counts Per Unit in macro
Post by: Tony Bullard 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
Title: Re: Setting Motor Counts Per Unit in macro
Post by: joeaverage 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
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Tony Bullard 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. 
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Mauri 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.
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Tony Bullard 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.
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Mauri 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.
Title: Re: Setting Motor Counts Per Unit in macro
Post by: joeaverage 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
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Tony Bullard 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. 
Title: Re: Setting Motor Counts Per Unit in macro
Post by: joeaverage 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
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Mauri 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.


Title: Re: Setting Motor Counts Per Unit in macro
Post by: joeaverage on January 12, 2018, 10:52:09 PM
Hi,
the speed calculation is reasonably straight forward.

My suggestion is to put some spindle speed adjustment code in the PLC script:
1) Read the current Z position (diameter)
2) Calculate the spindle rpm to suit the required surface speed
3) Apply max and /or min limits to the calculated spindle speed
4) Apply the calculated and limited spindle speed to the hardware spindle.

Step 4) is the critical one. I don't think trying to change the 'steps per unit' value on the fly is the right idea. Once Mach has planned the trajectory and dispatched it
to the controller you can't change it. The controller itself may be able to insert or remove pulses from the pulse stream like a THC function but Mach can't.

Niether can you issue another Gcode command without overwriting the current move and losing it. Lets say you have a coordinated move in X and Z:
G1 X100 Z100 F300.
After a second or so into the move Z has changed and therefore you want to change the spindle speed. If you did something like:
mc.mcCntlGcodeExecute(inst, "S680") 
for instance then it would crash the previous move which has yet to complete, and so wouldn't work.

This API may help:
Quote
LUA Syntax:
rc = mc.mcSpindleSetCommandRPM(
      number mInst,
      number RPM)
I've experimented with it a little and it seems to do the job. That is to say that you can issue a coordinated move, the PLC script will run during the move and it will calculate
the new required spindle speed and issue a speed command WITHOUT the currently executing move being affected.

Note that for the purposes of experimentation I have used a Step/Dir out of band motor as a spindle. I observed the spindle speed by monitoring the Sim plugin diagnostics
and it appears to work. I have not tried on my machine and it would represent quite a quite a re-wire from my current configuration. I presume it would also work
with the PWM output but I haven't tried it, that's your job!

I will hash up some code and post it soon.

Craig
Title: Re: Setting Motor Counts Per Unit in macro
Post by: joeaverage on January 13, 2018, 12:04:49 AM
Hi,
try put this in the PLC script:
Code: [Select]
local radius=mc.mcAxisGetPos(inst,mc.Z_AXIS)
if radius==0 then radius=1 end
local surfacespeed=mc.mcCntlGetPoundVar(inst,2134)
local spinspeed=surfacespeed/(6.282*radius)*360
if spinspeed>=15900 then spinspeed=15900 end
mc.mcSpindleSetCommandRPM(inst,spinspeed)

Craig
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Tony Bullard on January 13, 2018, 11:30:37 AM
I may be getting off subject but I did notice this. If I select “A Rollover” in Mach4 Configuration / General / Rotary Axis and send Gcode “G01 A 370 F10” the A axis DRO goes to 10,  (360° + 10°). Mach4 see 370 as degrees but handles them a linear.  Mach3 has an Angular Properties set up in General config that Mach4 is missing. See attached. Oops! Having adding pictures.
Title: Re: Setting Motor Counts Per Unit in macro
Post by: joeaverage on January 13, 2018, 02:19:16 PM
Hi Tony,
as far as I know Mach3 and Mach4 handle rollover the same...see attached.

Craig
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Mauri on January 13, 2018, 05:51:09 PM
Craig,
I setup a our old test Controller with ESS and a Motor connected to the A Axis on our bench and first ran some test code on Mach3 and timed it at various radius sizes and it worked perfectly as usual. Fast when the radius is small and slower and slower as when the radius was set large and larger.
It is also very accurate when doing a manual calculation comparing to its actual time to complete.
To do this you have to have a setting of .0001 in the Mach3 Setup for the A axis.

I then entered your PLC code into Mach4 screen under PLC and performed the same test.
The result was no speed change no mater what Z Axis radius was set and no time difference apart from the Z Axis Radius move variation.
The A Axis motor never changes speed.
So something is missing here.
Did you test it?
Regards,
Mauri.
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Mauri on January 13, 2018, 06:15:11 PM
Craig,
Test File I used.
G00 G49 G40 G80 G50 G90 G64 G21
G01 Z5.000 F400 -- changed Z to different values
G01 A360.000
G01 Z0.000
G01 A0.000
M30
I did some more testing to see what changes appear in Mach4.
The #2134 goes to 400.
The Spindle which started up at 8000 on the Mach4 Screen went to 15900 after the program had reached A360 and was about do go to zero on Z and A Axis.
So why is my spindle affected by this PLC code and not the A Axis?
Regards,
Mauri.
Title: Re: Setting Motor Counts Per Unit in macro
Post by: joeaverage on January 13, 2018, 06:17:17 PM
Hi,
as I posted I used the Sim plugin diagnostic to test it, I have no intention of re-wiring my machine...that's your job.

How are you controlling the A axis?. I used Step/Dir on an out of band axis. You cannot use a coordinated axis otherwise you will break legitimate moves when
you attempt to change the pulse rate on the A axis.

May I suggest trying to use an out of band axis, say OB1, that is motor 6. Per the Configure/Mach/Spindle page you will have to set Step/Dir axis as OB1 (6).
On Configure/Mach/Axis Mapping enable OB1 and assign motor 6.

Even if the axis is not equipped you should see the Step/Dir pulses on the motion controller diagnostic page.

I need to point out again YOU CANNOT USE A COORDINATED AXIS, it must be OUT OF BAND. Once a trajectory is planned and dispatched to the motion controller
it cannot be changed. Any attempt to change the motion of one of the coordinated axes will break the entire move. The API I have suggested allows a coordinated
move to be executed and yet allows changes to the pulse streams of out of band axes WITHOUT breaking the coordinated move.

Craig
Title: Re: Setting Motor Counts Per Unit in macro
Post by: joeaverage on January 13, 2018, 06:31:05 PM
Hi,
that test code is wrong, you are treating the A axis as a position controlled axis which is not possible if you which to change its rotational speed on the fly.

Quote
The #2134 goes to 400

Pound variable #2134 is the current feedrate in units per minute.

Quote
G01 A360.000

This is a positional move, the A axis is to accelerate to the current feedrate and then decelerate so that it turns 360 degrees in total. How are you expecting its
speed to vary? Its a coordinated axis and it accelerates and decelerates according to the motor tuning parameters you supplied.

Your A axis needs to be a spindle, that is to say a free spinning axis. Then repeated application of the mc.SpindleSetCommandRPM() will cause the rotational rate to
change in a manner for you to determine.

Craig
Title: Re: Setting Motor Counts Per Unit in macro
Post by: joeaverage on January 13, 2018, 06:43:32 PM
Hi,

Quote
So why is my spindle affected by this PLC code and not the A Axis

Because the API is a spindle command, if you hook your A axis up to the spindle output of your controller it will behave as a spindle. You would then
be able to vary its speed according to the radius, ie Z coordinate.

Craig
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Mauri on January 13, 2018, 06:47:41 PM
Craig,
Thanks for the reply.
So how does Mach3 do it with the A Axis just being a normal stepper motor setup?
How would I be able to setup my stepper as a spindle just using Mach4 when the code you provided affects the real spindle and not the A axis?
Need some more help here.
Regards,
Mauri.
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Mauri on January 13, 2018, 06:49:07 PM
Craig,
I think I was typing my note at the same time as you.
Regards,
Mauri.
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Mauri on January 13, 2018, 06:51:07 PM
Craig,
Am I supposed to enter the LUA Syntax somewhere?
rc = mc.mcSpindleSetCommandRPM(
      number mInst,
      number RPM)
Regards,
Mauri.
Title: Re: Setting Motor Counts Per Unit in macro
Post by: joeaverage on January 13, 2018, 06:54:01 PM
Hi,
your spindle is now your A axis. Hook your stepper to the Step/Dir signals for motor6.

That is how the API is described in the Docs. Look at how its used in the code I posted.

Craig
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Mauri on January 13, 2018, 06:56:13 PM
Craig,
So what happens to my normal spindle that my cutter is on, will it be affected by this code?
Regards,
Mauri.
Title: Re: Setting Motor Counts Per Unit in macro
Post by: joeaverage on January 14, 2018, 12:31:46 AM
Hi,
as far as I can work out Mach4 allows only one spindle. You have to choose between your regular spindle or an A axis (spindle). Given that the API's are for a spindle
I would suggest that the A axis be the controlled spindle and your regular spindle can still be controlled as an out of band axis but won't have the API's available.

Must confess that I'm quite familiar with coordinated axes but unfamiliar with out of band axes. Learning what controls are available for out of band axes is new
to me.

Craig
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Tony Bullard on January 14, 2018, 08:36:56 AM
Hi Tony,
as far as I know Mach3 and Mach4 handle rollover the same...see attached.

Craig

Yes they both have rollover properties but M4 does not have an axis designation checkbox (angular properties) that M3 has
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Chaoticone on January 14, 2018, 12:15:03 PM
Standard convention dictates that A,B and C are rotational axis. No need to have a check box to tell you that. If there was a check box, one option or the other would break standard convention. Mach 3 did not have true slaves or out of band axis.
Title: Re: Setting Motor Counts Per Unit in macro
Post by: joeaverage on January 14, 2018, 03:22:53 PM
Hi,
have found a couple of APIs that allow you to set an out of band axis as spindle on the fly. Would allow you
to switch between your main spindle and your A axis spindle at will.
mc.AxisGetSpindle
mc.AxisSetSpindle

Have not found any means to control an out of band axis other than that....yet. Hoping some Mach4 gurus will chime
in.

Craig
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Mauri on January 14, 2018, 04:50:46 PM
Craig,
That sounds more promising, as the other method just will not work for me.
I do not want to go back and control my main spindle manually.
My test would not allow the MPG to work on the A Axis and I could not see how Homing or Limits would work.
So unless a Mach4 Guru or the Mach4 programmer comes up with a solution that will allow all the proper functions to operate with A Axis and the Spindle and provide a way to make the A Axis using the Z Axis to change its speed, I will stay with Mach3 on our Router Table and not bother with the 4th Axis on our Mill.
May be before I hit the bucket someone will do this for us all.
Thanks Craig.
Regards,
Mauri.
Title: Re: Setting Motor Counts Per Unit in macro
Post by: joeaverage on January 14, 2018, 05:13:51 PM
Hi,
when I say control the spindle manually I was thinking that it could be turned on and off and speed controlled
from Mach but it would not have the spindle API suite to go with it.

Assuming we could get the main spindle to work in acceptable fashion that would mean that the A axis would be
your spindle with the spindle API suite. It is not clear to me how an MPG would work although I note that all the
out of band axes has jog control. I would guess that its possible.

Limits on a free running A axis don't make sense. Do you have rotational limits on a spindle? A home or index signal
do make sense. Even an out of band axis can be rotated to a given angle. Whether an A axis which is the current spindle
could in addition be indexed is a question I can only guess at.

Craig
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Mauri on January 14, 2018, 05:48:07 PM
Craig,
Yes I do have speed limits on my spindle set in Mach4 8000 min and 24000 max.
Are there any # variable that contain Velocity for the A Axis motor or is there a Fspeed # variable for A Axis?
Regards,
Mauri.
Title: Re: Setting Motor Counts Per Unit in macro
Post by: joeaverage on January 14, 2018, 05:57:16 PM
Hi,
yes speed limits no problem but not angular limits, angular limits don't make any sense on a free running axis.

I imagine there are pound variables for velocities etc but I don't know what they are at the moment.

Still, the bottleneck at the moment, is being able to control an out of band axis in absence of the spindle APIs.
Without that capability you would lose simultaneous  control of your main spindle.

Craig
Title: Re: Setting Motor Counts Per Unit in macro
Post by: joeaverage on January 14, 2018, 08:06:55 PM
Hi,
think I may have found the problem, according to this document Mach4Hobby is limited to one out of band axis.

Craig
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Mauri on January 14, 2018, 09:27:35 PM
Craig,
This is what I would like as lua script to make this work.

local radius=mc.mcAxisGetPos(inst,mc.Z_AXIS)
if radius==0 then radius=1 end
local surfacespeed=mc.mcCntlGetPoundVar(inst,2134)
local spinspeed=surfacespeed/((2*3.141592654*radius)/360)
if spinspeed>=1500 then spinspeed=1500 end

local mInst = 0;
local param = number for A Axis Velocity ???;
local value=A Axis Velocity (spinspeed);
mc.mcCntlSetPoundVar(mInst, param, value);

This would be an ideal way of having variable A Axis speed based on Z Axis radius.
However it may not work for 2 reasons.
1) There may not be any # Variable for A axis Velocity.
2) If there is it may not be allowed to be used while processing the G-Code or it may take affect after the next move as it does with #2134.

If there are any experts, on this, out there it would be great if they gave us some help.

Regards,
Mauri.
Title: Re: Setting Motor Counts Per Unit in macro
Post by: joeaverage on January 14, 2018, 10:36:16 PM
Hi,
that is very similar to the code I've already posted.

Note that for the purposes of  a variable speed A axis the A axis will temporarily become the spindle and your main
spindle becomes uncontrolled. This is a consequence of only being able to have one out of band axis in Mach4Hobby.

The code I posted uses the current feedrate, ie pound variable 2134. Note that the interpretation given to that number
is SURFACE SPEED. You could set it by issuing a Fnnnnn where nnnn is your desired surface speed but would also
secondarily double as the feedrate for the linear coordinated axes as well. Thus the normal feedrate interpretation
would change for the duration of the A axis assuming the nature of a spindle.

If however you wish to have a different value for surface speed you could pass that to Mach as a parameter.
Another alternative would be to have the desired surface speed in a persistant register.That number
could be manipulated to determine an angular speed. To my knowledge the only way to ensure that angular speed is reflected
at the spindle is mc.mcSpindleSetCommandRPM().

The advantage of passing surface speed as a parameter or using a register is that the feedrate F, will be consistent for your
linear axes.

Quote
mc.mcCntlSetPoundVar(mInst, param, value);
This sets a pound variable it does not ensure that the spindle will adopt that speed.

Craig
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Mauri on January 15, 2018, 05:21:13 AM
Craig,
At this stage I will give up and wait for the Mach4 programmer to make the code in Mach4 to perform the same action as Mach3.
I will have to see if I can modify the controller to be able to run both Mach3 for 4 Axis and Mach4 for 3 Axis on our Router Table using ESS.
At present we are using USS.
Regards,
Mauri.
Title: Re: Setting Motor Counts Per Unit in macro
Post by: joeaverage on January 15, 2018, 09:10:54 AM
Hi Mauri,
I think you'll be waiting a long time. NFS might reasonably claim that the tools have been provided for you to program your installation so that it behaves
in a manner that you determine.....if you can't or don't want to use those tools?

Craig
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Tony Bullard on December 07, 2018, 11:58:18 AM
Does the latest change to Mach4 address all the issues of this discussion?

From the change log.
"3804 - 3786
Mach4GUI: Get Parent
Core: Prevent rotary axis unit conversion.  mcAxisSetPos() would do a units conversion on any and all axes.  But mcAxisGetPos() always returned the axis position in native machine units.  mcAxisSetPos() was changed to always use native machine units (the original design intent). 
Mach4GUI: Prevent rotary axis unit conversion. All DRO display and entry unit conversions are handled in the GUI. 
Core: Prevent F from being affected by a unit conversion if it is used on a line with a rotary axis ONLY. 
Core: Add mcMotorSet/GetCountsPerUnit API.  "

If it looks promising I will download it and try it.
Thanks for all the help.
Title: Re: Setting Motor Counts Per Unit in macro
Post by: joeaverage on December 07, 2018, 12:39:38 PM
Hi Tony,
this thread is a few months old and in an earlier post I stated that Mach4 Hobby could only have one out of band axis according
to the features list published by NFS.

I have subsequently been informed by smurph that Mach4 Hobby does support all six out of band axes.

I don't think it bears on the problem you are talking about but thought I should correct the record.

Craig
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Tony Bullard on December 07, 2018, 01:04:42 PM

Thank you Craig. I'm back to the opening statement of this discussion.
"I’d like to change the Motor3 Counts Per Unit based on the diameter of work on a rotary axis." In my case I'm rotating a piece of pipe and cutting a profile on the end with Plasma on the Y axis. My code might be "G01 Y1 A2" where Y is inches and A is degrees. To get the vector velocity correct I need to change degrees to inches. The diameter will determin that. I'm hoping now to add a DRO for the diameter and code to update the Counts Per Unit for Motor3.

It has been so long that I've worked with code that I'm going to have to start all over again.
Title: Re: Setting Motor Counts Per Unit in macro
Post by: joeaverage on December 07, 2018, 01:25:53 PM
Hi,
there is an API for that, but I'm not sure that it was intended for use on the fly, that is to say I thought it was for use in plugins
where a parameter, in this case 'steps per unit', were set for a device and then left alone.

Quote
LUA Syntax:
rc = mc.mcMotorSetCountsPerUnit(
      number mInst,
      number motorId,
      number counts)

Description:
Set the counts per native machine setup units.

Craig
Title: Re: Setting Motor Counts Per Unit in macro
Post by: Tony Bullard on December 07, 2018, 01:53:02 PM
This may work out well for me because I am not cutting tapers. I would set the diameter DRO before I ran the job Just as I do in Mach3. I will have to play with this a little. It may not be soon. Maybe Maury could work with this on tapers.

Thank you Graig.