Package: cnc-centroid-skinning
unofficial cnc_centroid_skinning - A wrapper to the CNC12 API language.Introduction.I use for my cnc activities, the products developped by  centroidcnc :https://www.centroidcnc.com/centroidcnc has developped a  controller card  named ACORN :https://www.centroidcnc.com/centroid_diy/acorn_cnc_controller.htmland ACORN Mill and LatheCNC12software for use with the Centroid Acorn CNC controllerhttps://www.centroidcnc.com/centroid_diy/centroid_cnc_software_downloads.htmlThe goal: A Wrapper for pythonIn chapter1.11of CNC12's documentation: "CNC12 gives the user the ability to create a custom interface that can be
applied in many different ways".This wrapper allows to use this API in python language, with (almost) the same
interface than c#.  (https://centroidcncforum.com/viewtopic.php?f=60&t=3397)Example of use case: a video probingWith this wrapper, I have developed for internal use, a 'video probing'.
A  camera is placed on the head of cnc, and detects the center on a hole( thanks to opencv libraryhttps://pypi.org/project/opencv-python/).
This center is used as origin and the coordinate are sent directly to the CNC12 software. The head moves immediatly ( thanks tojob.RunCommand()).
the second step is to move  the head exactly above  the center of this hole.Write this kind of application is quite simply in python language with help of library and the cncSkinning api.Image Recognition library I used with camera for assertions is not included in this library.First releaseThis is the very first release of this wrapper, I couldn't test everything, but the main featuresseemto work.
The goal is to make it easy for everyone to use python to send and receive data for the CNC12 program.The version of  CNC12 used for my unittest is :4.5.I hope this wrapper allows enthusiasts like me, to simply develop their applications with CNC12.
Python is easy to use and allows rapid prototyping.WarningBe careful when you go to send commands, or update settings.
Keep in mind that you can move (see destroy) your material (it's not the worst...). There is no
protection like on the 'acorn wizard' and you can send many bad values. verify each time if the wrapper method is correct
and respond like described in the documentation.This interface is notreally tested, don't trust it.I disclaim any responsibility for any accident, injury or damage suffered by anyone would use this wrapper.Please, read the chapter :'CNC Machine Tool Safety'in the documentation of CNC centroid.InstallationIf you have pip, installation is straightforwardpip install cnc-centroid-skinningThis will automatically install dependencies as well as their dependencies.The documentation.The /CncSkinningDocumentation given by Cnc Centroid has the same packages with the same
reference. There are some differences, however:The methods begin with a lowercase.The return code is not given, but in case of a value different of 'SUCCESS' , an ErrorCodeException is raised.documentationExamplesVerify the communication betwwen this wrapper and CNC12 (Of course, your CNC12 software is already launched, else no communication is possible):the function **detect_cnc(path_of_cnc12) ** is written for that.>>> from cnc_centroid_skinning import detect_cnc
>>> detect_cnc("c:\cnct")  
'cnc_centroid_skinning communicates... OK' 
>>>Ask configuration>>> from cnc_centroid_skinning import CncSkinning
>>> sk = CncSkinning("c:\cnct")                     # create the instance 
>>> sk.isConstructed()                  
True
>>> sk.state.getAcornBoardRevision()
4
>>> sk.system.getSystemIdentifier()
115202849
>>> from cnc_centroid_skinning  import Axes,Direction
>>> sk.axis.getLabel(Axes.AXIS_1)
'Z'
>>> sk.axis.getTravelLimit(Axes.AXIS_1,Direction.PLUS)
300Send a string message to the window message:>>> sk.message_window.addMessage('move in 5 seconds...')
>>> sk.message_window.getMessages()[-1]
'move in 5 seconds...'or>>> sk.message_window.message = 'move in 5 seconds...'
>>> sk.message_window.message
'move in 5 seconds...'Run command (more than one way is possible) with a message window given.Verify machine is clear to move the following distance: Z0 -> +Z50Be carrefully with this order, if a command is already running, the next command is ignored
until the job is finished.
You can see below a method  to detect than the job is finished by  poll the last messagen
'306 job finished', but it's not a real good way.>>>  sk.job.RunCommand("G4 P5.0\nG53 G0 Z0\nZ50",require_cycle_start=False)
>>>  while not sk.message_window.message.startswith('306'): time.sleep(0.3) # job finished
>>>  sk.job.RunCommand("G53 G0 Z0",require_cycle_start=False)or>>>  sk.job.gcode ="G4 P5.0", "G53 G0 Z0","Z50" 
>>> while not sk.message_window.message.startswith('306'): time.sleep(0.3) # job finished
>>>Use the french language for menus, prompt....(see 12.3.11 Parameter 9 â€“ Display Language)>>> sk.param.getMachineParameterValue(9)   # 0 = english
0
>>> sk.param.setMachineParameter(9,2)
>>> sk.system.exitSoftware() # Restart is mandatoryor>>> sk.parameter[9] 
0
>>> sk.parameter[9] = 2  
>>> sk.system.exitSoftware() # Restart is mandatorytodo listVcp is not testedImprove unittest's behaviorIt's the first version of docstring, le param values are not described....