TechDraw API/ru

These functions are part of the TechDraw Workbench and can be used in macros and from the Python console once the module has been imported.

Good examples of basic TechDraw scripting can be found in the unit test scripts.

See the TechDrawGui API for more functions.

Example:

Example:

Example:

Example:

Example:

CosmeticVertex (CV) routines accessible from Python
dvp = App.ActiveDocument.View #CV's belong to views.

Add a CosmeticVertex at p1 (View coordinates). Returns unique tag. tag = dvp.makeCosmeticVertex(vector p1)

Add a CosmeticVertex at p1 (3d model coordinates). Returns unique tag. tag = dvp.makeCosmeticVertex3d(vector p1)

Returns CosmeticVertex with unique id. cv = dvp.getCosmeticVertex(string id)

Returns CosmeticVertex with name (Vertex6). Used in selections. cv = dvp.getCosmeticVertexBySelection(string name)

Removes CosmeticVertex from View. Returns None. dvp.removeCosmeticVertex(object cv)

Removes all CosmeticVertices from the View. Returns None. dvp.clearCosmeticVertices

CosmeticView attributes Tag: unique identifier. String. Point: location within view. Vector.



CosmeticEdge (CE) routines accessible from Python
dvp = App.ActiveDocument.View #CE's belong to views.

Make a CosmeticEdge from p1 to p2(View coordinates). Returns unique tag. tag = dvp.makeCosmeticLine(p1, p2)

Make a CosmeticEdge at center with radius radius(View coordinates). Returns unique tag. tag = dvp.makeCosmeticCircle(center, radius)

Make a CosmeticEdge at center with radius radius(View coordinates) from start angle to end angle. Returns unique tag. tag = dvp.makeCosmeticCircleArc(center, radius, start, end)

Returns CosmeticEdge with unique id. ce = dvp.getCosmeticEdge(id)

Returns CosmeticEdge by name (Edge25). Used in selections. ce = dvp.getCosmeticEdgeBySelection(name)

Removes CosmeticEdge ce from View. Returns None. dvp.removeCosmeticEdge(ce)

Removes all CosmeticLines from the View. Returns None. dvp.clearCosmeticEdges

CosmeticEdge attributes Tag: unique identifier. String. Format: appearance attributes (style, color, weight, visible). Tuple.



CenterLine (CL) routines accessible from Python
Makes a new CenterLine tag = dvp.makeCenterLine(subObjs, mode)

Retrieves CenterLine with unique tag. cl = dvp.getCenterLine(tag)

Retrieves CenterLine by subobject name. Used in selection. cl = dvp.getCenterLine("Edge5")

Removes CenterLine cl from View. Returns None. dvp.removeCenterLine(cl)

CenterLine Attributes Tag: unique identifier. String. ReadOnly. Type: 0 - face, 1 - 2 line, 2 - 2 point. Integer. ReadOnly. Mode: 0 - vert, 1 - horiz, 2 - aligned. Integer. Format: appearance attributes (style, color, weight, visible). Tuple. HorizShift: left/right offset. Float. VertShift: up/down offset. Float. Rotation: rotation in degrees. Float. Extension: additional length to be added. Float. Flip: reverse the order of points for 2 point CenterLine. Boolean. Edges: names of source edges. List of string. Faces: names of source faces. List of string. Points: names of source points (Vertices). List of string.



DrawViewPart Geometry
[topoShapeEdge] = dvp.getVisibleEdges

[topoShapeEdge] = dvp.getHiddenEdges

topoShapeEdge = dvp.getEdgeByIndex(i) topoShapeEdge = dvp.getEdgeBySelection("Edge1")

topoShapeVertex = dvp.getVertexByIndex(i) topoShapeVertex = dvp.getVertexBySelection("Vertex1")

Redraw the graphic for this View. dvp.requestPaint