Public Member Functions

def applyTrans (self, sh)
 
def characters (self, content)
 
def endElement (self, name)
 
def format (self, obj)
 
def getMatrix (self, tr)
 
def startElement (self, name, attrs)
 
def translateVec (self, vec, mat)
 

Public Attributes

 col
 
 color
 
 count
 
 currentsymbol
 
 disableUnitScaling
 
 fill
 
 grouptransform
 
 lastdim
 
 lw
 
 style
 
 svgdpi
 
 symbols
 
 text
 
 transform
 
 viewbox
 
 width
 
 x
 
 y
 

Detailed Description

Parse SVG files and create FreeCAD objects.

Member Function Documentation

◆ applyTrans()

def importSVG.svgHandler.applyTrans (   self,
  sh 
)
Apply transformation to the shape and return the new shape. Parameters ---------- sh : Part.Shape or Draft.Dimension Object to be transformed

References importSVG.svgHandler.grouptransform, Base::ViewProjMethod.transform, ArchSite.Compass.transform, and importSVG.svgHandler.transform.

◆ characters()

def importSVG.svgHandler.characters (   self,
  content 
)
Read characters from the given string.

References importSVG.svgHandler.currentsymbol, TestSpreadsheet.SpreadsheetCases.doc, Mod.Show.SceneDetails.Camera.Camera.doc, PathTests.TestPathUtil.TestPathUtil.doc, PathTests.TestPathToolController.TestPathToolController.doc, Mod.Show.SceneDetails.ObjectClipPlane.ObjectClipPlane.doc, Mod.PartDesign.WizardShaft.WizardShaft.TaskWizardShaft.doc, Mod.Show.SceneDetails.ClipPlane.ClipPlane.doc, Mod.Show.SceneDetails.VProperty.VProperty.doc, Mod.Show.SceneDetail.SceneDetail.doc, Mod.Show.SceneDetails.Pickability.Pickability.doc, PathTests.TestPathStock.TestPathStock.doc, PathTests.TestPathHelix.TestPathHelix.doc, PathTests.TestPathPost.PathPostTestCases.doc, PathTests.TestPathSetupSheet.TestPathSetupSheet.doc, Commands.TemplatePyMod_Cmd2.doc, drafttests.test_pivy.DraftPivy.doc, drafttests.test_dwg.DraftDWG.doc, drafttests.test_modification.DraftModification.doc, drafttests.test_oca.DraftOCA.doc, drafttests.test_dxf.DraftDXF.doc, drafttests.test_svg.DraftSVG.doc, drafttests.test_airfoildat.DraftAirfoilDAT.doc, drafttests.test_creation.DraftCreation.doc, Py::PythonType.doc(), Mod.PartDesign.WizardShaft.Shaft.Shaft.doc, Import::ImportOCAFAssembly.doc, Import::ImportOCAF.doc, Gui::GraphvizView.doc, draftguitools.gui_annotationstyleeditor.AnnotationStyleEditor.doc, Sandbox::CustomAddObjectEvent.doc, draftguitools.gui_base.GuiCommandSimplest.doc, ExpressionCompleterModel::Info.doc, WorkingPlane.Plane.doc, PartGui::FaceColors::Private.doc, Sandbox::CustomRemoveObjectEvent.doc, PartDesignGui::ComboLinks.doc, App::RelabelDocumentExpressionVisitor.doc, Import::ImportXCAF.doc, Sandbox::CustomRecomputeEvent.doc, Sandbox::DocumentSaverThread.doc, draftguitools.gui_base_original.DraftTool.doc, App::DynamicProperty::PropData.doc, draftguitools.gui_base.GuiCommandBase.doc, App::LinkBaseExtension::PropInfo.doc, MeshPartGui::Mesh2ShapeGmsh::Private.doc, ItemInfo.doc, ItemInfo2.doc, importIFClegacy.IfcEntity.doc, importSVG.svgHandler.fill, importSVG.svgHandler.grouptransform, importSVG.svgHandler.symbols, Gui::Dialog::DlgCheckableMessageBox.text, iisIconLabelScheme.text, Gui::SequencerDialogPrivate.text, Gui::Dialog::DlgParameterFind::Options.text, Gui::SequencerBarPrivate.text, draftguitools.gui_texts.Text.text, exportIFCHelper.SIUnitCreator.text, Gui::DAG::VertexProperty.text, Gui::Flag.text, draftguitools.gui_shapestrings.ShapeString.text, Gui::SoRegPoint.text, draftviewproviders.view_dimension.ViewProviderLinearDimension.text, Gui::ToolTip.text, Gui::LabelEditor.text, App::StringExpression.text, draftviewproviders.view_dimension.ViewProviderAngularDimension.text, importSVG.svgHandler.text, Base::ViewProjMethod.transform, ArchSite.Compass.transform, importSVG.svgHandler.transform, importSVG.svgHandler.translateVec(), Base::Vector2d.x, Base::DualQuat.x, Base::Vector3< _Precision >.x, R2.x, Gui::DockWnd::SelectionView.x, R3.x, Gui::SelectionChanges.x, uvPtStruct.x, DraftGui.DraftToolBar.x, XYZ.x, Gui::SelectionSingleton::SelObj.x, Gui::PropertyEditor::PropertyVectorItem.x, Gui::PropertyEditor::PropertyVectorDistanceItem.x, Gui::SelectionSingleton::_SelObj.x, importSVG.svgHandler.x, Base::Vector2d.y, Base::DualQuat.y, Base::Vector3< _Precision >.y, R2.y, Gui::DockWnd::SelectionView.y, R3.y, Gui::SelectionChanges.y, uvPtStruct.y, DraftGui.DraftToolBar.y, XYZ.y, Gui::SelectionSingleton::SelObj.y, Gui::PropertyEditor::PropertyVectorItem.y, Gui::PropertyEditor::PropertyVectorDistanceItem.y, Gui::SelectionSingleton::_SelObj.y, and importSVG.svgHandler.y.

◆ endElement()

def importSVG.svgHandler.endElement (   self,
  name 
)
Finish processing the element indicated by the name. Parameters ---------- name : str The name of the element

References importSVG.svgHandler.currentsymbol, TestSpreadsheet.SpreadsheetCases.doc, Mod.Show.SceneDetails.Camera.Camera.doc, PathTests.TestPathUtil.TestPathUtil.doc, PathTests.TestPathToolController.TestPathToolController.doc, Mod.Show.SceneDetails.ObjectClipPlane.ObjectClipPlane.doc, Mod.Show.SceneDetails.VProperty.VProperty.doc, Mod.PartDesign.WizardShaft.WizardShaft.TaskWizardShaft.doc, Mod.Show.SceneDetails.ClipPlane.ClipPlane.doc, Mod.Show.SceneDetails.Pickability.Pickability.doc, Mod.Show.SceneDetail.SceneDetail.doc, PathTests.TestPathStock.TestPathStock.doc, PathTests.TestPathHelix.TestPathHelix.doc, PathTests.TestPathPost.PathPostTestCases.doc, PathTests.TestPathSetupSheet.TestPathSetupSheet.doc, Commands.TemplatePyMod_Cmd2.doc, drafttests.test_pivy.DraftPivy.doc, drafttests.test_airfoildat.DraftAirfoilDAT.doc, drafttests.test_dxf.DraftDXF.doc, drafttests.test_modification.DraftModification.doc, drafttests.test_oca.DraftOCA.doc, drafttests.test_dwg.DraftDWG.doc, drafttests.test_svg.DraftSVG.doc, drafttests.test_creation.DraftCreation.doc, Py::PythonType.doc(), Mod.PartDesign.WizardShaft.Shaft.Shaft.doc, Import::ImportOCAFAssembly.doc, Import::ImportOCAF.doc, Gui::GraphvizView.doc, draftguitools.gui_annotationstyleeditor.AnnotationStyleEditor.doc, Sandbox::CustomAddObjectEvent.doc, draftguitools.gui_base.GuiCommandSimplest.doc, ExpressionCompleterModel::Info.doc, WorkingPlane.Plane.doc, PartGui::FaceColors::Private.doc, Sandbox::CustomRemoveObjectEvent.doc, PartDesignGui::ComboLinks.doc, App::RelabelDocumentExpressionVisitor.doc, Import::ImportXCAF.doc, Sandbox::CustomRecomputeEvent.doc, Sandbox::DocumentSaverThread.doc, draftguitools.gui_base_original.DraftTool.doc, App::DynamicProperty::PropData.doc, draftguitools.gui_base.GuiCommandBase.doc, App::LinkBaseExtension::PropInfo.doc, MeshPartGui::Mesh2ShapeGmsh::Private.doc, ItemInfo.doc, ItemInfo2.doc, importIFClegacy.IfcEntity.doc, importSVG.svgHandler.grouptransform, importSVG.svgHandler.symbols, Gui::Dialog::DlgCheckableMessageBox.text, iisIconLabelScheme.text, Gui::SequencerDialogPrivate.text, Gui::Dialog::DlgParameterFind::Options.text, Gui::SequencerBarPrivate.text, draftguitools.gui_texts.Text.text, exportIFCHelper.SIUnitCreator.text, Gui::DAG::VertexProperty.text, Gui::Flag.text, draftguitools.gui_shapestrings.ShapeString.text, Gui::SoRegPoint.text, draftviewproviders.view_dimension.ViewProviderLinearDimension.text, Gui::ToolTip.text, Gui::LabelEditor.text, App::StringExpression.text, draftviewproviders.view_dimension.ViewProviderAngularDimension.text, importSVG.svgHandler.text, Base::ViewProjMethod.transform, ArchSite.Compass.transform, and importSVG.svgHandler.transform.

◆ format()

◆ getMatrix()

def importSVG.svgHandler.getMatrix (   self,
  tr 
)
Return a FreeCAD matrix from an SVG transform attribute. Parameters ---------- tr : str The type of transform: 'matrix', 'translate', 'scale', 'rotate', 'skewX', 'skewY' and its value Returns ------- Base::Matrix4D The translated matrix.

◆ startElement()

def importSVG.svgHandler.startElement (   self,
  name,
  attrs 
)
Re-organize data into a nice clean dictionary. Parameters ---------- name : str Name of the element: 'path', 'rect', 'line', 'polyline', 'polygon', 'ellipse', 'circle', 'text', 'tspan', 'symbol' attrs : iterable Dictionary of content of the elements

References importSVG.svgHandler.count, Py::SeqBase< T >::iterator.count, Py::SeqBase< T >::const_iterator.count, importDXF.dxfcounter.count, importSVG.getsize(), importSVG.svgHandler.grouptransform, and importSVG.svgHandler.svgdpi.

◆ translateVec()

def importSVG.svgHandler.translateVec (   self,
  vec,
  mat 
)
Translate (move) a point or vector by a matrix. Parameters ---------- vec : Base::Vector3 The original vector mat : Base::Matrix4D The translation matrix, from which only the elements 14, 24, 34 are used.

Referenced by importSVG.svgHandler.characters().

Member Data Documentation

◆ col

importSVG.svgHandler.col

◆ color

◆ count

◆ currentsymbol

importSVG.svgHandler.currentsymbol

◆ disableUnitScaling

importSVG.svgHandler.disableUnitScaling

◆ fill

importSVG.svgHandler.fill

◆ grouptransform

◆ lastdim

importSVG.svgHandler.lastdim

◆ lw

importSVG.svgHandler.lw

◆ style

importSVG.svgHandler.style

◆ svgdpi

importSVG.svgHandler.svgdpi

◆ symbols

importSVG.svgHandler.symbols

◆ text

◆ transform

◆ viewbox

importSVG.svgHandler.viewbox

◆ width

◆ x

◆ y


The documentation for this class was generated from the following file:
  • src/Mod/Draft/importSVG.py