Path Postprocessor Customization/de

Einführung
FreeCAD verwendet als interne Darstellungen für die erzeugten Pfade so genannte G-Codes. Sie können solche Dinge beschreiben wie: Geschwindigkeit und Vorschübe, Anhalten des Motors usw.. Aber das Wichtigste sind die Bewegungen, die sie beschreiben. Diese Bewegungen sind ziemlich einfach: Sie können gerade Linien oder Kreisbögen sein. Anspruchsvollere Kurven wie B-Splines werden bereits von FreeCADs Pfad Arbeitsbereich angenähert.

Was der Nachbearbeiter für dich tun kann
Many mills use G-codes as well to control the milling process. They may look almost like the internal codes, but there may be some differences:
 * the machine can have a special startup sequence
 * it can have a special stop sequence
 * arcs can be defined with a relative or an absolute center
 * it may require line numbers in a certain format
 * it can used so called canned cycles for predefined subprocesses such as drilling
 * You might prefer your g-code output in either metric or imperial units.
 * It might be useful to perform a set of moves prior to calling for a tool change to make the action easier for the operator
 * You might wish to include comments for readability or suppress them to keep the program small
 * You might wish to include a custom header to identify or document the program for future reference.

Darüber hinaus gibt es weitere Sprachen zur Steuerung einer Fräse, wie z.B. HPGL, DXF oder andere.

Der Nachbearbeiter ist ein Programm, das die internen Codes in eine vollständige Datei übersetzt, die auf deine Maschine hochgeladen werden kann.

Vorbereitung zum Schreiben deines eigenen Nachbearbeiters
Du kannst mit einem sehr einfachen Modell beginnen, das zeigt, wie deine Maschine gerade Linien und Bögen liest. Bereite es mit einem beliebigen Programm vor, das für deine Maschine geeignet ist.

A file for such paths starting at (0,0,0) and going towards Y would be helpful. Make sure it is the tool itself moving along this path, i.e. no tool radius compensation must be applied.



The path in FreeCAD would look like this. Please note the small blue arrow, it indicates the starting direction. For a very first go you may provide only one level in the XY-plane.



You can then have a look at the file and compare it to the output of existing postprocessors such as or  and try yourself to adapt them or you upload your to the path forum https://forum.freecadweb.org/viewforum.php?f=15 to get some help.

Namenskonvention
For a file format the postprocessor should get the name

If you are testing, place it in your macro directory. If it functions well, please consider providing it for others to benefit (post it to the FreeCAD Path forum) so that it can be included in the FreeCAD distribution going forward.

Andere vorhandene Nachbearbeiter
For comparison you may look at the postprocessors which come with your FreeCAD installation. They are located under the Mod directory in Path/PathScripts/post. Widely used are the linuxcnc and the grbl postprocessors. Studying their code can give helpful insights.

Programming your own postprocessor
This post discusses some internals from the linuxcnc postprocessors. The same strucure is used in other postprocessors as well.

Looking at linuxcnc_post.py, you'll see the export function (as of 0.19.20514 its at line 156)

it collects step by step in the variable "gcode" the processed G-codes and handles the overall exporting of post-processable objects (operations, tools, jobs ,etc). Export handles the high level stuff like comments and coolant but any objects that have multiple path commands (tool changes and operations) it delegates to the parse function (as of 0.19.20514 its at line 288).

Similarly to the "export" function collects parse the G-codes in the variable "out". In the variable "command" the commands as seen in the Path workbench's "inspect G-code" function are stored and can be investigated for further processing.

It recognizes the different G, M, F, S, and other G-codes. By remembering the last command in the variable "lastcommand" it can suppress subsequent repetitions of modal commands.

Both parse and export are just formatting strings and concatenating them together into what will be the final output.

You'll see that both functions also call the "linenumber" function. If the user wants line numbers, the linenumber function returns the string to stick in to the appropriate spot, otherwise it returns an empty string so nothing is added.

Verwandtes

 * [[Image:Path_PostProcess.svg|24px]] Pfad NachBearbeitung