# Python: module skeinforge_application.skeinforge_plugins.craft_plugins.alteration

skeinforge_application.skeinforge_plugins.craft_plugins.alteration ($Date: 2008/02/05 $) | index /home/enrique/Desktop/backup/babbleold/script/reprap/fabmetheus/skeinforge_application/skeinforge_plugins/craft_plugins/alteration.py

Previous / Next / Contents

`
The alteration plugin adds the start and end files to the gcode.
This plugin also removes the alteration prefix tokens from the alteration lines. Alteration lines have a prefix token so they can go through the craft plugins without being modified. However, the tokens are not recognized by the firmware so they have to be removed before export. The alteration token is:
(<alterationDeleteThisPrefix/>)
The alteration manual page is at:
http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Alteration
Operation
Settings
Name of End File
Name of Start File
Remove Redundant Mcode
Replace Variable with Setting
Examples
`

## Operation

The default 'Activate Alteration' checkbox is on. When it is on, the functions described below will work, when it is off, nothing will be done.

## Settings

Alteration looks for alteration files in the alterations folder in the .skeinforge folder in the home directory. Alteration 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.

### Name of End File

Default is 'end.gcode'.
If there is a file with the name of the "Name of End File" setting, it will be added to the very end of the gcode.

### Name of Start File

Default is 'start.gcode'.
If there is a file with the name of the "Name of Start File" setting, it will be added to the very beginning of the gcode.

### Remove Redundant Mcode

Default: True
If 'Remove Redundant Mcode' is selected then M104 and M108 lines which are followed by a different value before there is a movement will be removed. For example, if there is something like:
M113 S1.0
M104 S60.0
(<layer> 0.72 )
M104 S200.0
(<skirt>)
with Remove Redundant Mcode selected, that snippet would become:
M113 S1.0
M104 S200.0
(<layer> 0.72 )
(<skirt>)
This is a relatively safe procedure, the only reason it is optional is because someone might make an alteration file which, for some unknown reason, requires the redundant mcode.

### Replace Variable with Setting

Default: True
If 'Replace Variable with Setting' is selected and there is an alteration line with a setting token, the token will be replaced by the value.
For example, if there is an alteration line like:
M140 S<setting.chamber.BedTemperature>
the token would be replaced with the value and assuming the bed chamber was 60.0, the output would be:
M140 S60.0

## Examples

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

Previous / Next / Contents

Modules

``

__init__ fabmetheus_utilities.archive cStringIO | fabmetheus_utilities.fabmetheus_tools.fabmetheus_interpret fabmetheus_utilities.gcodec fabmetheus_utilities.settings | skeinforge_application.skeinforge_utilities.skeinforge_craft skeinforge_application.skeinforge_utilities.skeinforge_polyfile skeinforge_application.skeinforge_utilities.skeinforge_profile | sys

Classes

``

AlterationRepository
AlterationSkein

class AlterationRepository
`` | `A class to handle the alteration settings.`

Methods defined here:

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

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

class AlterationSkein
`` | `A class to alteration a skein of extrusions.`

Methods defined here:

__init__(self)
  `Initialize.`

addFromUpperLowerFile(self, fileName)
  `Add lines of text from the fileName or the lowercase fileName, if there is no file by the original fileName in the directory.`

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

getReplacedAlterationLine(self, alterationFileLine, searchIndex=0)
  `Get the alteration file line with variables replaced with the settings.`

getReplacedAlterationText(self)
  `Replace the alteration lines if there are settings.`

parseInitialization(self)
  `Parse gcode initialization and store the parameters.`

setSettingDictionary(self)
  `Set the setting dictionary from the gcode text.`

Functions

``

getCraftedText(fileName, text='', repository=None)
  `Alteration a gcode linear move text.`

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

getGcodeTextWithoutRedundantMcode(gcodeText)
  `Get gcode text without redundant M104 and M108.`

getLinesWithoutRedundancy(duplicateWord, lines)
  `Get gcode lines without redundant first words.`

getNewRepository()
  `Get new repository.`

main()
  `Display the alteration dialog.`

writeOutput(fileName, shouldAnalyze=True)
  `Alteration a gcode linear move file. Chain alteration the gcode if the alteration procedure has not been done.`

Data
`` |  | __author__ = 'Enrique Perez (perez_enrique@yahoo.com)' __date__ = '$Date: 2008/02/05 $' __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)