FreeCAD Logo FreeCAD 1.0
  • Английский Африкаанс Арабский Белорусский Каталанский Чешский Немецкий Греческий Испанский Испанский Баскский Финский Филиппинский Французский Галисийский Хорватский Венгерский Индонезийский Итальянский Японский Кабильский Корейский Литовский Нидерландский Норвежская букмол Польский Португальский Португальский Румынский Русский Словацкий Словенский Сербский Шведский Турецкий Украинский Валенсианский Вьетнамский Китайский Китайский
  • Возможности
  • Скачать
  • Блог
  • Документация
    Индекс документации Приступая к работе Пользовательская документация Руководство по FreeCAD Документация верстаков Документация по кодированию на Python Документация по коду C++ Уроки Часто задаваемые вопросы Политика конфиденциальности О программе FreeCAD
  • Внести вклад
    Как помочь Sponsor Сообщить об ошибке Сделать запрос Задачи и финансирование Руководство по участию в разработке Руководство для разработчиков Переводы
  • Сообщество
    Кодекс поведения Форум The FPA GitHub GitLab Codeberg Mastodon Matrix IRC IRC via Webchat Gitter Discord Reddit Twitter Facebook LinkedIn Календарь
  • ♥ Donate

Donate

$
Информация о SEPA
Пожалуйста, настройте банковский перевод SEPA:
Beneficiary: The FreeCAD project association
IBAN: BE04 0019 2896 4531
BIC/SWIFT: GEBABEBBXXX
Банковское агентство: BNP Paribas Fortis
Адрес: Rue de la Station 64, 1360 Perwez, Belgium

While Stripe doesn't support monthly donations, you can still become a sponsor! Simply make a one-time donation equivalent to 12 months of support, and you'll gain access to the corresponding sponsoring tier. It's an easy and flexible way to contribute.

If you are not sure or not able to commit to a regular donation, but still want to help the project, you can do a one-time donation, of any amount.

Choose freely the amount you wish to donate one time only.

You can support FreeCAD by sponsoring it as an individual or organization through various platforms. Sponsorship provides a steady income for developers, allowing the FPA to plan ahead and enabling greater investment in FreeCAD. To encourage sponsorship, we offer different tiers, and unless you choose to remain anonymous, your name or company logo will be featured on our website accordingly.

from 1 USD / 1 EUR per month. You will not have your name displayed here, but you will have helped the project a lot anyway. Together, normal sponsors maintain the project on its feet as much as the bigger sponsors.

from 25 USD / 25 EUR per month. Your name or company name is displayed on this page.

from 100 USD / 100 EUR per month. Your name or company name is displayed on this page, with a link to your website, and a one-line description text.

from 200 USD / 200 EUR per month. Your name or company name and logo displayed on this page, with a link to your website and a custom description text. Companies that have helped FreeCAD early on also appear under Gold sponsors.

Instead of donating each month, you might find it more comfortable to make a one-time donation that, when divided by twelve, would give you right to enter a sponsoring tier. Don't hesitate to do so!

Choose freely the amount you wish to donate each month.

Please inform your forum name or twitter handle as a notein your transfer, or reach to us, so we can give you proper credits!

Эта документация не закончена. Пожалуйста, помогите и внесите свой вклад в разработку документации.

Пример документирования команды Gui объясняет, как должны быть задокументированы команды. Просмотрите Category:UnfinishedDocu/ru, чтобы увидеть больше незавершённых страниц, подобных этой. Смотрите Category:Command Reference/ru для всех команд.

Смотрите Wiki Страницы, чтобы узнать о редактировании вики-страниц, и зайдите на страницу Помоги FreeCAD, чтобы узнать о других способах, которыми вы можете внести свой вклад.

SetupSheet
Fourth axis
CAM

Введение

FreeCAD использует внутреннее представление для сгенерированных трасс инструментов, называемых G-кодами. Они могут описывать такие вещи как: скорость и глубина резания, остановка мотора и так далее... Но важнее всего описываемое ими движение. Эти движения обычно просты: это могут быть прямые линии или дуги. Более сложные кривые вроде B-сплайнов апроксимируются верстаком Path FreeCADа.

Что для вас может сделать постпроцессор

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.
  • ...

Furthermore there are other languages to control a mill, such as HPGL, DXF, or others.

The postprocessor is a program which translates the internal codes into a complete file, that can be uploaded to your machine.

Preparation for writing your own postprocessor

You may start with a very simple model showing how your machine reads straight lines and arcs. Prepare it with any program suitable for your machine.

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 linux_cnc_post.py or grbl_post.py and try yourself to adapt them or you upload your to the Path/CAM forum to get some help.

Naming convention

The postprocessor can be placed in your FreeCAD macro directory. For a prefix <filename> the postprocessor should get the name <filename>_post.py. Please note that the postfix and extension, _post.py, have to be lower case.

The new name should be reflected at the head of the parser arguments list in the <filename>_post.py file, e.g.:

parser = argparse.ArgumentParser(prog="grbl", add_help=False)

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/CAM forum) so that it can be included in the FreeCAD distribution going forward.

Other existing postprocessors

For comparison you may look at the postprocessors which come with your FreeCAD installation. They are located under the directory <path_to_your_FreeCAD_distro>/Mod/CAM/Path/Post/scripts. 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 linux_cnc_post.py, you'll see the export function (as of 0.19.20514 it's at line 156)

def export(objectslist, filename, argstring):
    # pylint: disable=global-statement
    ...
    gcode = ""
    ...
    ...

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 CAM commands (tool changes and operations) it delegates to the parse function (as of 0.19.20514 it's at line 288).

def parse(pathobj):
    ...
    out = ""
    lastcommand = None
    ...
    ...

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

for c in pathobj.Path.Commands:

            command = c.Name

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.

Adding a custom post-processor

1. Access the Macro Path:

Go to the menu Edit → Preferences → Python → Macro. Note the path listed in the Macro Path field (e.g., /home/user/snap/freecad/common).

2. Copy the Post-Processor File:

Place your file (e.g., new_post.py) directly into the Macro Path folder noted in the previous step (e.g., /home/user/snap/freecad/common/new_post.py).

Notes

  • Ensure the file has the necessary read/write permissions.
  • Restart FreeCAD to apply the changes.

Related

  • CAM PostProcess


SetupSheet
Fourth axis
CAM

Эта страница получена от https://wiki.freecad.org/CAM_Postprocessor_Customization

Свяжитесь с нами!
Forum GitHub Mastodon Matrix IRC Gitter.im Discord Reddit Twitter Facebook LinkedIn

©Команда FreeCAD. Авторы изображений (сверху вниз): ppemawm, r-frank, epileftric, regis, regis, rider_mortagnais, bejant.

Этот проект поддерживается: , KiCad Services Corp. и другие спонсоры

GitHubУлучшить эту страницу на GitHub