TechDraw API/ro

Aceste funcții fac parte din TechDraw Workbench și pot fi utilizate în script-uri și macro sau din interpretorul Python, odată ce modulul  a fost importat. Exemple bune de programare-script de bază TechDraw pot fi găsite în unit test scripts.

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

A se vedea TechDrawGui API pentru mai mule funcții.

Exempluː

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.