Python: module skeinforge_application.skeinforge_plugins.craft_plugins.export

skeinforge_application.skeinforge_plugins.craft_plugins.export ($Date: 2008/21/04 $) | index /home/enrique/Desktop/backup/babbleold/script/reprap/fabmetheus/skeinforge_application/skeinforge_plugins/craft_plugins/export.py

Previous / Next / Contents

`
Export is a craft tool to pick an export plugin, add information to the file name, and delete comments.
The export manual page is at:
http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Export
Operation
Settings
Add Descriptive Extension
Add Profile Extension
Add Timestamp Extension
Also Send Output To
Analyze Gcode
Comment Choice
Do Not Delete Comments
Delete Crafting Comments
Delete All Comments
Export Operations
File Extension
Name of Replace File
Save Penultimate Gcode
Examples
`

## Operation

The default 'Activate Export' checkbox is on. When it is on, the functions described below will work, when it is off, the functions will not be called.

## Settings

### Add Descriptive Extension

Default is off.
When selected, key profile values will be added as an extension to the gcode file. For example:
test.04hx06w_03fill_2cx2r_33EL.gcode
would mean:
* . (Carve section.)
* 04h = 'Layer Height (mm):' 0.4
* x
* 06w = 0.6 width i.e. 0.4 times 'Edge Width over Height (ratio):' 1.5
* _ (Fill section.)
* 03fill = 'Infill Solidity (ratio):' 0.3
* _ (Multiply section; if there is one column and one row then this section is not shown.)
* 2c = 'Number of Columns (integer):' 2
* x
* 2r = 'Number of Rows (integer):' 2.
* _ (Speed section.)
* 33EL = 'Feed Rate (mm/s):' 33.0 and 'Flow Rate Setting (float):' 33.0. If either value has a positive value after the decimal place then this is also shown, but if it is zero it is hidden. Also, if the values differ (which they shouldn't with 5D volumetrics) then each should be displayed separately. For example, 35.2E30L = 'Feed Rate (mm/s):' 35.2 and 'Flow Rate Setting (float):' 30.0.

### Add Profile Extension

Default is off.
When selected, the current profile will be added to the file extension. For example:
test.my_profile_name.gcode

### Add Timestamp Extension

Default is off.
When selected, the current date and time is added as an extension in format YYYYmmdd_HHMMSS (so it is sortable if one has many files). For example:
test.my_profile_name.20110613_220113.gcode

### Also Send Output To

Default is empty.
Defines the output name for sending to a file or pipe. A common choice is stdout to print the output in the shell screen. Another common choice is stderr. With the empty default, nothing will be done. If the value is anything else, the output will be written to that file name.

### Analyze Gcode

Default is on.
When selected, the penultimate gcode will be sent to the analyze plugins to be analyzed and viewed.

### Comment Choice

Default is 'Delete All Comments'.

#### Do Not Delete Comments

When selected, export will not delete comments. Crafting comments slow down the processing in many firmware types, which leads to pauses and therefore a lower quality print.

#### Delete Crafting Comments

When selected, export will delete the time consuming crafting comments, but leave the initialization comments. Since the crafting comments are deleted, there are no pauses during extrusion. The remaining initialization comments provide some useful information for the analyze tools.

#### Delete All Comments

When selected, export will delete all comments. The comments are not necessary to run a fabricator. Some printers do not support comments at all so the safest way is choose this option.

### Export Operations

Export presents the user with a choice of the export plugins in the export_plugins folder. The chosen plugin will then modify the gcode or translate it into another format. There is also the "Do Not Change Output" choice, which will not change the output. An export plugin is a script in the export_plugins folder which has the getOutput function, the globalIsReplaceable variable and if it's output is not replaceable, the writeOutput function.

### File Extension

Default is gcode.
Defines the file extension added to the name of the output file. The output file will be named as originalname_export.extension so if you are processing XYZ.stl the output will by default be XYZ_export.gcode

### Name of Replace File

Default is replace.csv.
When export is exporting the code, if there is a tab separated file with the name of the "Name of Replace File" setting, it will replace the string in the first column by its replacement in the second column. If there is nothing in the second column, the first column string will be deleted, if this leads to an empty line, the line will be deleted. If there are replacement columns after the second, they will be added as extra lines of text. There is an example file replace_example.csv to demonstrate the tab separated format, which can be edited in a text editor or a spreadsheet.
Export looks for the alteration file in the alterations folder in the .skeinforge folder in the home directory. Export does not care if the text file names are capitalized, but some file systems do not handle file name cases properly, so to be on the safe side you should give them lower case names. If it doesn't find the file it then looks in the alterations folder in the skeinforge_plugins folder.

### Save Penultimate Gcode

Default is off.
When selected, export will save the gcode file with the suffix '_penultimate.gcode' just before it is exported. This is useful because the code after it is exported could be in a form which the viewers can not display well.

## Examples

The following examples export the file Screw Holder Bottom.stl. The examples are run in a terminal in the folder which contains Screw Holder Bottom.stl and export.py.
> python export.py
This brings up the export dialog.
> python export.py Screw Holder Bottom.stl
The export tool is parsing the file:
Screw Holder Bottom.stl
..
The export tool has created the file:
.. Screw Holder Bottom_export.gcode

Previous / Next / Contents

Modules

``

__init__ fabmetheus_utilities.archive cStringIO fabmetheus_utilities.euclidean | fabmetheus_utilities.fabmetheus_tools.fabmetheus_interpret fabmetheus_utilities.gcodec fabmetheus_utilities.intercircle os | fabmetheus_utilities.settings skeinforge_application.skeinforge_utilities.skeinforge_analyze skeinforge_application.skeinforge_utilities.skeinforge_craft skeinforge_application.skeinforge_utilities.skeinforge_polyfile | skeinforge_application.skeinforge_utilities.skeinforge_profile sys time

Classes

``

ExportRepository
ExportSkein

class ExportRepository
`` | `A class to handle the export settings. `

Methods defined here:

__init__(self)
  `Set the default settings, execute title & settings fileName.`

execute(self)
  `Export button has been clicked.`

class ExportSkein
`` | `A class to export a skein of extrusions. `

Methods defined here:

__init__(self)

addLine(self, line)
  `Add a line of text and a newline to the output.`

getCraftedGcode(self, repository, gcodeText)
  `Parse gcode text and store the export gcode.`

getLineWithTruncatedNumber(self, character, line, splitLine)
  `Get a line with the number after the character truncated.`

parseLine(self, line)
  `Parse a gcode line.`

Functions

``

getCraftedTextFromText(gcodeText, repository=None)
  `Export a gcode linear move text.`

getDescriptionCarve(lines)
  `Get the description for carve.`

getDescriptionFill(lines)
  `Get the description for fill.`

getDescriptionMultiply(lines)
  `Get the description for multiply.`

getDescriptionSpeed(lines)
  `Get the description for speed.`

getDescriptiveExtension(gcodeText)
  `Get the descriptive extension.`

getDistanceGcode(exportText)
  `Get gcode lines with distance variable added, this is for if ever there is distance code.`

getFirstValue(gcodeText, word)
  `Get the value from the first line which starts with the given word.`

getNewRepository()
  `Get new repository.`

getReplaceableExportGcode(nameOfReplaceFile, replaceableExportGcode)
  `Get text with strings replaced according to replace.csv file.`

getSelectedPluginModule(plugins)
  `Get the selected plugin module.`

getSettingString(lines, procedureName, settingNameStart)
  `Get the setting value from the lines, return None if there is no setting starting with that name.`

main()
  `Display the export dialog.`

sendOutputTo(outputTo, text)
  `Send output to a file or a standard output.`

writeOutput(fileName, shouldAnalyze=True)
  `Export a gcode linear move file.`

Data

``

__author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
__credits__ = 'Gary Hodgson <http://garyhodgson.com/reprap/2011/06/hacking-skeinforge-export-module/>'
__date__ = '$Date: 2008/21/04 $'
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
absolute_import = _Feature((2, 5, 0, 'alpha', 1), (2, 7, 0, 'alpha', 0), 16384)

Author
`` |  | Enrique Perez (perez_enrique@yahoo.com)

Credits
`` |  | Gary Hodgson <http://garyhodgson.com/reprap/2011/06/hacking-skeinforge-export-module/>