FreeCAD Python
Functions
importSVG Namespace Reference

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.

Functions

def transformCopyShape (shape, m)
 
def getsize (length, mode='discard', base=1)
 
def makewire (path, checkclosed=False, donttry=False)
 
def arccenter2end (center, rx, ry, angle1, angledelta, xrotation=0.0)
 
def arcend2center (lastvec, currentvec, rx, ry, xrotation=0.0, correction=False)
 

Function Documentation

◆ arccenter2end()

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)

◆ arcend2center()

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+),(...-)]

◆ getsize()

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

◆ makewire()

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

◆ transformCopyShape()

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