# Python: module skeinforge_tools.import_plugins.xml

skeinforge_tools.import_plugins.xml ($Date: 2008/21/04 $) | index /home/enrique/Desktop/backup/babbleold/script/reprap/pyRepRap/skeinforge_tools/import_plugins/xml.py

`The xml.py script is an import translator plugin to get a carving from an Art of Illusion xml file.
An import plugin is a script in the import_plugins folder which has the function getCarving. It is meant to be run from the
interpret tool. To ensure that the plugin works on platforms which do not handle file capitalization properly, give the plugin
a lower case name.
The getCarving function takes the file name of an xml file and returns the carving.
This example gets a triangle mesh for the xml file boolean.xml. This example is run in a terminal in the folder which contains
boolean.xml and xml.py.
> python
Python 2.5.1 (r251:54863, Sep 22 2007, 01:43:31)
[GCC 4.2.1 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xml
>>> xml.getCarving().getCarveRotatedBoundaryLayers()
[-1.159765625, None, [[(-18.925000000000001-2.4550000000000001j), (-18.754999999999981-2.4550000000000001j)
..
many more lines of the carving
..
An xml file can be exported from Art of Illusion by going to the "File" menu, then going into the "Export" menu item, then
picking the XML choice. This will bring up the XML file chooser window, choose a place to save the file then click "OK".
Leave the "compressFile" checkbox unchecked. All the objects from the scene will be exported, this plugin will ignore
the light and camera. If you want to fabricate more than one object at a time, you can have multiple objects in the Art of
Illusion scene and they will all be carved, then fabricated together.`

Modules

``

__init__ skeinforge_tools.skeinforge_utilities.euclidean | skeinforge_tools.skeinforge_utilities.gcodec skeinforge_tools.skeinforge_utilities.intercircle | math sys | skeinforge_tools.skeinforge_utilities.triangle_mesh

Classes

``

Matrix4By4
TriangleMeshObjectInfo
  CSGObjectObjectInfo
  CubeObjectInfo
    CylinderObjectInfo
    SphereObjectInfo
XMLCarving

class CSGObjectObjectInfo(TriangleMeshObjectInfo)
`` | `An Art of Illusion CSG object info.`

Methods defined here:

__repr__(self)
  `Get the string representation of this object info.`

getIntersectedLoops(self, importRadius, subObjectInfoLoopsList)
  `Get intersected loops sliced through shape.`

getJoinedLoops(self, importRadius, subObjectInfoLoopsList)
  `Get joined loops sliced through shape.`

getLoops(self, importRadius, z)
  `Get loops sliced through shape.`

getSubtractedLoops(self, importRadius, subObjectInfoLoopsList)
  `Get subtracted loops sliced through shape.`

getVertices(self)
  `Get all vertices.`

setShape(self, matrix4By4)
  `Set the shape of this carvable object info.`

Methods inherited from TriangleMeshObjectInfo:

__init__(self)
  `Set name to None.`

getNewCarvableObjectInfo(self, objectInfoElement)
  `Get new carvable object info.`

getTransformAttributeTable(self, coords, transformName)
  `Get the transform attributes.`

class CubeObjectInfo(TriangleMeshObjectInfo)
`` | `An Art of Illusion Cube object info.`

Methods defined here:

setBottomTopTriangleMesh(self, edgeTriples, matrix4By4, vertexPairs, vertices)
  `Set the bottom, top and triangle mesh of this carvable object info.`

setShape(self, matrix4By4)
  `Set the shape of this carvable object info.`

Methods inherited from TriangleMeshObjectInfo:

__init__(self)
  `Set name to None.`

__repr__(self)
  `Get the string representation of this object info.`

getLoops(self, importRadius, z)
  `Get loops sliced through shape.`

getNewCarvableObjectInfo(self, objectInfoElement)
  `Get new carvable object info.`

getTransformAttributeTable(self, coords, transformName)
  `Get the transform attributes.`

getVertices(self)
  `Get all vertices.`

class CylinderObjectInfo(CubeObjectInfo)
`` | `An Art of Illusion Cylinder object info.`

Method resolution order:
  CylinderObjectInfo
  CubeObjectInfo
  TriangleMeshObjectInfo

Methods defined here:

setShape(self, matrix4By4)
  `Set the shape of this carvable object info.`

Methods inherited from CubeObjectInfo:

setBottomTopTriangleMesh(self, edgeTriples, matrix4By4, vertexPairs, vertices)
  `Set the bottom, top and triangle mesh of this carvable object info.`

Methods inherited from TriangleMeshObjectInfo:

__init__(self)
  `Set name to None.`

__repr__(self)
  `Get the string representation of this object info.`

getLoops(self, importRadius, z)
  `Get loops sliced through shape.`

getNewCarvableObjectInfo(self, objectInfoElement)
  `Get new carvable object info.`

getTransformAttributeTable(self, coords, transformName)
  `Get the transform attributes.`

getVertices(self)
  `Get all vertices.`

class Matrix4By4
`` | `A four by four matrix.`

Methods defined here:

__init__(self)
  `Add empty lists.`

__repr__(self)
  `Get the string representation of this four by four matrix.`

getFromAttributeTable(self, attributeTable)
  `Get the from row column attribute strings, counting from one.`

getMultiplied(self, otherMatrix)
  `Get this matrix multiplied by the other matrix.`

setMatrixToZero(self)
  `Get the matrix elements to zero.`

class SphereObjectInfo(CubeObjectInfo)
`` | `An Art of Illusion Sphere object info.`

Method resolution order:
  SphereObjectInfo
  CubeObjectInfo
  TriangleMeshObjectInfo

Methods defined here:

setShape(self, matrix4By4)
  `Set the shape of this carvable object info.`

Methods inherited from CubeObjectInfo:

setBottomTopTriangleMesh(self, edgeTriples, matrix4By4, vertexPairs, vertices)
  `Set the bottom, top and triangle mesh of this carvable object info.`

Methods inherited from TriangleMeshObjectInfo:

__init__(self)
  `Set name to None.`

__repr__(self)
  `Get the string representation of this object info.`

getLoops(self, importRadius, z)
  `Get loops sliced through shape.`

getNewCarvableObjectInfo(self, objectInfoElement)
  `Get new carvable object info.`

getTransformAttributeTable(self, coords, transformName)
  `Get the transform attributes.`

getVertices(self)
  `Get all vertices.`

class TriangleMeshObjectInfo
`` | `An Art of Illusion object info.`

Methods defined here:

__init__(self)
  `Set name to None.`

__repr__(self)
  `Get the string representation of this object info.`

getLoops(self, importRadius, z)
  `Get loops sliced through shape.`

getNewCarvableObjectInfo(self, objectInfoElement)
  `Get new carvable object info.`

getTransformAttributeTable(self, coords, transformName)
  `Get the transform attributes.`

getVertices(self)
  `Get all vertices.`

setShape(self, matrix4By4)
  `Set the shape of this carvable object info.`

class XMLCarving
`` | `An svg carving.`

Methods defined here:

__init__(self)
  `Add empty lists.`

__repr__(self)
  `Get the string representation of this carving.`

getCarveCornerMaximum(self)
  `Get the corner maximum of the vertices.`

getCarveCornerMinimum(self)
  `Get the corner minimum of the vertices.`

getCarveLayerThickness(self)
  `Get the layer thickness.`

getCarveRotatedBoundaryLayers(self)
  `Get the rotated boundary layers.`

getExtruderPaths(self, z)
  `Get extruder loops.`

getZAddExtruderPaths(self, z)
  `Get next z and add extruder loops.`

parseXML(self, xmlText)
  `Parse XML text and store the layers.`

setActualMinimumZ(self, halfHeight, layerTop)
  `Get the actual minimum z at the lowest rotated boundary layer.`

setCarveBridgeLayerThickness(self, bridgeLayerThickness)
  `Set the bridge layer thickness. If the infill is not in the direction of the bridge, the bridge layer thickness should be given as None or not set at all.`

setCarveImportRadius(self, importRadius)
  `Set the import radius.`

setCarveIsCorrectMesh(self, isCorrectMesh)
  `Set the is correct mesh flag.`

setCarveLayerThickness(self, layerThickness)
  `Set the layer thickness.`

Functions

``

addCarvableObjectInfo(carvableObjectInfos, objectInfoElement)
  `Add the object info if it is carvable.`

addCarvableObjectInfoWithMatrix(carvableObjectInfos, matrix4By4, objectInfoElement)
  `Add the object info if it is carvable.`

addLineLoopsIntersections(loopLoopsIntersections, loops, pointBegin, pointEnd)
  `Add intersections of the line with the loops.`

addLineXSegmentIntersection(lineLoopsIntersections, segmentFirstX, segmentSecondX, vector3First, vector3Second, y)
  `Add intersections of the line with the x segment.`

addLoopLoopsIntersections(loop, loopsLoopsIntersections, otherLoops)
  `Add intersections of the loop with the other loops.`

addLoopXSegmentIntersections(lineLoopsIntersections, loop, segmentFirstX, segmentSecondX, segmentYMirror, y)
  `Add intersections of the loop with the x segment.`

addLoopsXSegmentIntersections(lineLoopsIntersections, loops, segmentFirstX, segmentSecondX, segmentYMirror, y)
  `Add intersections of the loops with the x segment.`

getBottom(points)
  `Get the bottom of the points.`

getCarvableClassObjectInfoTable()
  `Get the carvable class object info table.`

getCarvableObjectInfo(objectInfoElement)
  `Get the object info if it is carvable.`

getCarving(fileName='')
  `Get the carving for the xml file.`

getInBetweenPointsFromLoops(importRadius, loops)
  `Get the in between points from loops.`

getInBetweenPointsFromLoopsBoundarySideOtherLoops(inside, importRadius, loops, otherLoops, radiusSide)
  `Get the in between points from loops.`

getJoinedList(originalLists)
  `Get the lists as one joined list.`

getLoopsListsIntersections(loopsList)
  `Get intersections betweens the loops lists.`

getLoopsLoopsIntersections(loops, otherLoops)
  `Get all the intersections of the loops with the other loops.`

getPointsBoundarySideLoops(inside, loops, points, radius)
  `Get the points inside the loops.`

getSubObjectInfoLoopsList(importRadius, subObjectInfos, z)
  `Get subObjectInfo loops list.`

getTop(points)
  `Get the top of the points.`

getTransformedByList(floatList, point)
  `Get the point transformed by the array.`

getValueInQuotes(name, text, value)
  `Get value in quotes after the name.`

getVector3TransformedByMatrix(matrix, vector3)
  `Get the vector3 multiplied by a vector3.`

isPointOrEitherBoundarySideInsideLoops(inside, loops, pointBegin, pointCenter, pointEnd, radius)
  `Determine if the point or a point on either side of the point, is inside the loops.`

isPointOrEitherLineBoundarySideInsideLoops(inside, loops, pointBegin, pointCenter, pointEnd, radius)
  `Determine if the point or a point on either side of the point, is inside the loops.`

main(hashtable=None)
  `Display the inset dialog.`

Data

``

__author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
__credits__ = 'Nophead <http://hydraraptor.blogspot.com/>\nArt of Illusion <http://www.artofillusion.org/>'
__date__ = '$Date: 2008/21/04 $'
__license__ = 'GPL 3.0'
absolute_import = _Feature((2, 5, 0, 'alpha', 1), (2, 7, 0, 'alpha', 0), 16384)
globalCarvableClassObjectInfoTable = {'CSGObject': CSGObjectObjectInfo, 'Cube': CubeObjectInfo, 'Cylinder': CylinderObjectInfo, 'Sphere': SphereObjectInfo, 'TriangleMesh': TriangleMeshObjectInfo}

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

Credits
`` |  | Nophead <http://hydraraptor.blogspot.com/> Art of Illusion <http://www.artofillusion.org/>