PyAcad 0.4.1

Geometry Utilities


ads.distance(pt1, pt2) -> distance
Returns the distance between points pt1 and pt2. The pt1 and pt2 arguments are three-dimensional points.
ads.angle(appname) -> angle
Returns the angle between the line from point pt1 to point pt2 and the X axis of the current UCS, with the angle increasing in counterclockwise direction. The pt1 and pt2 arguments are two-dimensional points (the Z coordinates are ignored). The angle is returned in radians.
ads.polar(point, angle, distance) -> point
Finds a point by means of polar coordinates. The point argument and result are three-dimensional points. The angle is expressed in radians, measured from the X axis with the value increasing in the counterclockwise direction.
ads.inters(line1, line2 [, teston]) -> point
Examines two lines and returns the point where they intersect. The line arguments are tuples of two points each. The optional teston argument is an int and specifies that the intersection must lie on the given line segments when non zero. If teston is not given or zero, then the two lines are considered to be of infinite length for intersection testing.
ads.textbox(acad_ename) -> (pt1, pt2)
ads.textbox(assoc_list) -> (pt1, pt2)

Finds the coordinates of a box that encloses a text entity. If the argument is an acad_ename object specifying an existing text, attdef or attrib entity in the current drawing, then the bounding box of this entity is returned. If the argument is an assoc list (a sequence of ads_cons objects) that describes the properties of a text entity, then the bounding box of this virtual text entity is returned. If the first element of the assoc list specifies an existing text, attdef or attrib entity (with code -1), then the properties of this entity will be used, while each of the following ads_cons objects overrides a overrides the entity's acutal attributes.

If the association list doesn't begin with a -1 ads_cons object, it must begin with a 0 (entity type) element, and it must contain an element that contains the string itself. This is a 1 (value) element for a text or attrib entity, or a 2 (tag string) element for an attdef entity. Other values are assumed to be the default values unless they are explicitly specified. The defaults are as follows:

Style (7) the current text style
Size (40) the size of the style if that is fixed; otherwise the current default size of the style
Width factor (41) the default width of the style
Obliquing angle (51) the default angle of the style

Note: This function does not work with paragraph text (mtext) or mtext formatting characters.

ads.trans(point, from, to, [, displ]) -> point

Translates a point or a displacement from one coordinate system into another. The point argument is a 3D point or a 3D displacement vector. The from argument specifies the coordinate system in which pt is expressed, and the to argument specifies the coordinate system of this function's result. If the disp argument is nonzero, pt is treated as a displacement vector; otherwise, it is treated as a point.

The from and to arguments can specify a coordinate system in any of the following ways: