99. plugins.draw2d — Interactive 2D drawing in a 3D space

This pyFormex plugin provides some interactive 2D drawing functions. While the drawing operations themselves are in 2D, they can be performed on a plane with any orientation in space. The constructed geometry always has 3D coordinates in the global cartesian coordinate system.

99.1. Functions defined in module plugins.draw2d

plugins.draw2d.draw2D(mode='point', npoints=-1, zvalue=0.0, zplane=None, func=None, preview=False, coords=None, **kargs)[source]

Enter interactive drawing mode and return the 2D drawing.

Drawing is done on a plane perpendicular to the camera axis, at a specified z value. If zplane is specified, it is used directly. Else, it is computed from projecting the point [0.,0.,zvalue]. Specifying zvalue is in most cases easier for the user. See meth:QtCanvas.idraw for more details. This function differs in that it provides default displaying during the drawing operation and a button to stop the drawing operation.

(TODO) The drawing can be edited using the methods ‘undo’, ‘clear’ and ‘close’, which are presented in a combobox.

plugins.draw2d.drawnObject(points, mode='point')[source]

Return the geometric object resulting from draw2D points

plugins.draw2d.highlight_drawing(canvas, coords, drawmode, numbered=False)[source]

Highlight a temporary drawing on the canvas.

pts is an array of points.

plugins.draw2d.preview_drawing(canvas)[source]

Function executed during preview

Adds the point to a temporary drawing and then draws it

plugins.draw2d.accept_point(canvas)[source]

Function to be executed when a new point is clicked

Adds the point to the accepted drawing and then draws it

plugins.draw2d.drawObject2D(mode, npoints=-1, zvalue=0.0, preview=False, coords=None)[source]

Draw a 2D opbject in the xy-plane with given z-value

plugins.draw2d.objectName(actor)[source]

Find the exported name corresponding to a canvas actor

plugins.draw2d.splitPolyLine(c)[source]

Interactively split the specified polyline

plugins.draw2d.set_grid(*, autosize, dx, dy, width, height, point, normal, lcolor, lwidth, showplane, pcolor, alpha, **kargs)[source]

Show the grid with specified parameters

plugins.draw2d.create_grid()[source]

Interactively create the grid