TechDraw API/fr

Ces fonctions font partie de l'Atelier TechDraw et peuvent être utilisées dans macros et à partir de la console Python une fois que le module a été importé.

Vous trouverez de bons exemples de scripts TechDraw de base dans le site 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)

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

remove 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)

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

remove 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
make a new CenterLine tag = dvp.makeCenterLine(subObjs, mode)

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

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

remove 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")

dvp.requestPaint Redraw the graphic for this View.