importSVG Namespace Reference

SVG file importer & exporter. More...

Classes

class  svgHandler
 

Functions

def arccenter2end (center, rx, ry, angle1, angledelta, xrotation=0.0)
 
def arcend2center (lastvec, currentvec, rx, ry, xrotation=0.0, correction=False)
 
def decodeName (name)
 
def export (exportList, filename)
 
def getcolor (color)
 
def getContents (filename, tag, stringmode=False)
 
def getrgb (color)
 
def getsize (length, mode='discard', base=1)
 
def insert (filename, docname)
 
def makewire (path, checkclosed=False, donttry=False)
 
def open (filename)
 
def transformCopyShape (shape, m)
 

Variables

 draftui
 
 gui
 
 pythonopen = open
 
dictionary svgcolors
 
 svgcolorslower
 

Detailed Description

SVG file importer & exporter.

This module provides support for importing and exporting SVG files. It enables importing/exporting objects directly to/from the 3D document, but doesn't handle the SVG output from the Drawng and TechDraw modules.

Function Documentation

def importSVG.arccenter2end (   center,
  rx,
  ry,
  angle1,
  angledelta,
  xrotation = 0.0 
)
calculate start and end vector and flags of an arc given in center parametrization
see http://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes
returns (v1,v2,largerc,sweep)
def importSVG.arcend2center (   lastvec,
  currentvec,
  rx,
  ry,
  xrotation = 0.0,
  correction = False 
)
calculate (positive and negative) possible centers for an arc in endpoint parameterization
see http://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes
rotation or x-axis has to be specified in radians (CCW)
the sweepflag is interpreted as: sweepflag <==>  arc is travelled clockwise 
returns [(vcenter+,angle1+,angledelta+),(...-)]

References DraftVecUtils.angle(), and Draft.precision().

def importSVG.decodeName (   name)
def importSVG.export (   exportList,
  filename 
)

References Draft.getSVG(), and pythonopen.

def importSVG.getcolor (   color)
def importSVG.getContents (   filename,
  tag,
  stringmode = False 
)

References pythonopen.

Referenced by Draft.loadSvgPatterns().

def importSVG.getrgb (   color)
def importSVG.getsize (   length,
  mode = 'discard',
  base = 1 
)
parses length values containing number and unit
with mode 'discard': extracts a number from the given string (removes unit suffixes)
with mode 'tuple': return number and unit as a tuple
with mode 'css': convert the unit to px assuming 90dpi
with mode 'mm': convert the unit to millimeter assuming 90dpi

Referenced by importSVG.svgHandler.startElement().

def importSVG.insert (   filename,
  docname 
)

References pythonopen.

def importSVG.makewire (   path,
  checkclosed = False,
  donttry = False 
)
try to make a wire out of the list of edges. If the 'Wire' functions fails or the wire is not
closed if required the 'connectEdgesToWires' function is used

References Draft.precision().

def importSVG.open (   filename)

References pythonopen.

Referenced by importDXF.exportPageLegacy().

def importSVG.transformCopyShape (   shape,
  m 
)
apply transformation matrix m on given shape
since OCCT 6.8.0 transformShape can be used to apply certian non-orthogonal
transformations on shapes. This way a conversion to BSplines in
transformGeometry can be avoided.

Variable Documentation

importSVG.draftui
importSVG.gui
importSVG.pythonopen = open

Referenced by export(), getContents(), insert(), and open().

dictionary importSVG.svgcolors
importSVG.svgcolorslower
Initial value:
1 = dict((key.lower(),value) for key,value in \
2  list(svgcolors.items()))