TechDraw API: Difference between revisions

From FreeCAD Documentation
No edit summary
No edit summary
Line 24: Line 24:
{{APIFunction|findOuterWire|listOfEdges|Finds the OuterWire (largest) of a list of edges (that form a planar graph).|Outer wire}}
{{APIFunction|findOuterWire|listOfEdges|Finds the OuterWire (largest) of a list of edges (that form a planar graph).|Outer wire}}
{{APIFunction|findShapeOutline|TopoShape, scale, direction|Project shape in direction and find outer wire of result.|Outline wire}}
{{APIFunction|findShapeOutline|TopoShape, scale, direction|Project shape in direction and find outer wire of result.|Outline wire}}
{{APIFunction|viewPartAsDxf|DrawViewPart|Return the edges of a DrawViewPart in Dxf format.|String}}
{{APIFunction|viewPartAsSvg|DrawViewPart|Return the edges of a DrawViewPart in Svg format.|String}}





Revision as of 15:53, 23 June 2017

These functions are part of the TechDraw module and can be used in scripts and macros or from the python interpreter, once the TechDraw module has been imported.

Example:

import FreeCAD
import TechDraw
page = FreeCAD.ActiveDocument.addObject('TechDraw::DrawPage','Page')
FreeCAD.ActiveDocument.addObject('TechDraw::DrawSVGTemplate','Template')
FreeCAD.ActiveDocument.Template.Template = templateFileSpec
FreeCAD.ActiveDocument.Page.Template = FreeCAD.ActiveDocument.Template
page.ViewObject.show()
view = FreeCAD.ActiveDocument.addObject('TechDraw::DrawViewPart','View')
rc = page.addView(view)


EdgeWalker(listOfEdges, [bool])

Description: Creates wires from edges in input by planar graph traversal. Optionally exclude the OuterWire by setting optional parameter to false.

Returns: List of wires sorted by size (descending)

findOuterWire(listOfEdges)

Description: Finds the OuterWire (largest) of a list of edges (that form a planar graph).

Returns: Outer wire

findShapeOutline(TopoShape, scale, direction)

Description: Project shape in direction and find outer wire of result.

Returns: Outline wire

viewPartAsDxf(DrawViewPart)

Description: Return the edges of a DrawViewPart in Dxf format.

Returns: String

viewPartAsSvg(DrawViewPart)

Description: Return the edges of a DrawViewPart in Svg format.

Returns: String