PSC Code Manual

util/object/line.lsp [src]

Polyline handling functions

Functions

Function signature Description
(add-polyline container ins vertices closed-p) Adds a LWPolyline to CONTAINER at INS
(add-rectangle container width height ins) Adds a rectangular LWPolyline to CONTAINER using add-polyline
(add-slot container ins len dia) Adds a slot polyline to CONTAINER
(dualoffset&delete pline dist bulge) Convenience wrapper for offset&close
(get-vlist pline) Returns the list of vertices comprising PLINE in the form (x y bulge)
(line-obj->vert-lst line) Returns the list of vertices comprising LINE
(offset&close pline dist dual bulge) Offsets PLINE by DIST and joins both lines into a closed polygon
(offset-polyline pline dist) Offsets PLINE by DIST and returns the resulting polyline

(add-polyline container ins vertices closed-p)

Adds a LWPolyline to CONTAINER at INS

INS should be a 2D or 3D point. VERTICES should be a list of points. Z-coordinates in
VERTICES are treated as bulge values (all points are 2D). Points without Z-coordinates
have 0 added to the end.

If CLOSED-P is non-nil, set the Closed property to True.

VARS:
(CONTAINER VLA-OBJECT)
(INS LIST (POINT-P INS))
(VERTICES LIST (VL-EVERY 'POINT-P VERTICES))

(add-rectangle container width height ins)

Adds a rectangular LWPolyline to CONTAINER using add-polyline

INS is at the bottom-left corner of the rectangle. To put rectangles in other quadrants,
supply negative values for WIDTH, HEIGHT, or both.

VARS:
(CONTAINER VLA-OBJECT)
(WIDTH nil (NUMBERP WIDTH))
(HEIGHT nil (NUMBERP WIDTH))
(INS LIST (POINT-P INS))

(add-slot container ins len dia)

Adds a slot polyline to CONTAINER

INS is in the middle of the centerline and the slot extends horizontally to the left and
right by half of LEN. LEN describes the extents of the hole, including radius, not just
the centerline.

VARS:
(CONTAINER VLA-OBJECT)
(INS LIST (POINT-P INS))
(LEN nil (NUMBERP LEN))
(DIA nil (NUMBERP DIA))

(dualoffset&delete pline dist bulge)

Convenience wrapper for offset&close

Supplies t for DUAL argument, deletes the original polyline, and returns the resulting
offset polyline.

VARS:
(PLINE VLA-OBJECT)
(DIST nil (NUMBERP DIST))

(get-vlist pline)

Returns the list of vertices comprising PLINE in the form (x y bulge)

VARS:
(PLINE VLA-OBJECT)

(line-obj->vert-lst line)

Returns the list of vertices comprising LINE

LINE can be a Line, Polyline or 3DPolyline

VARS:
(LINE VLA-OBJECT (MEMBER (vla-get-ObjectName LINE) '("AcDbLine" "AcDbPolyline" "AcDb3dPolyline")))

(offset&close pline dist dual bulge)

Offsets PLINE by DIST and joins both lines into a closed polygon

DIST being negative means to offset in the negative direction. If DUAL is non-nil, offset
in both directions and deletes the original line.

If BULGE is non-nil, either or both of the closing lines will be bulged out to a
semicircle. If BULGE is a non-nil scalar, both ends will be bulged. BULGE may also be a
2-item list, with the boolean value of the car indicating whether to bulge the end at the
head of the original line, and the cadr meaning the tail end.

VARS:
(PLINE VLA-OBJECT)
(DIST nil (NUMBERP DIST))

(offset-polyline pline dist)

Offsets PLINE by DIST and returns the resulting polyline

Essentially a wrapper for VLA-Offset that cracks the acorn and extracts the delicious
offset polyline hidden within a hard outer shell of safearray.

VARS:
(PLINE VLA-OBJECT)
(DIST nil (NUMBERP DIST))