VS:Rect

From Vectorworks Developer
Revision as of 14:36, 12 August 2013 by Root (talk | contribs) (1 revision)
Jump to navigation Jump to search

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Procedure Rect creates a rectangle object in a VectorWorks document.

The procedure will accept coordinate definitions by either of two methods : coordinate values or distance angle values. Coordinate values are the absolute coordinate locations(in the documents' coordinate system) and are expressed as x and y values.

Distance-angle values are expressed as a distance and angle from the current pen position. For Rect, two distance angle pairs are required to specify the top left and bottom right of the rectangle object.

PROCEDURE Rect(
p1x :REAL;
p1y :REAL;
p2x :REAL;
p2y :REAL);
def vs.Rect(p1, p2):
    return None

Parameters

p1x REAL Top left X coordinate of rectangle.
p1y REAL Top left Y coordinate of rectangle.
p2x REAL Bottom right X coordinate of rectangle.
p2y REAL Bottom right Y coordinate of rectangle.

Example

VectorScript

PROCEDURE Example;
VAR
red, green, blue, color :LONGINT;
criteria :STRING;
BEGIN
red := 65535;
green := 0;
blue := 0;
RGBToColorIndex(red, green, blue, color);
Rect(0, 0, 1, 1);
SetPenFore(LNewObj, color);
DSelectAll;
criteria := Concat('(INSYMBOL & INVIEWPORT & (PF=', color, '))');
SelectObj(criteria);
Message(criteria);
DeleteObjs;
END;
RUN(Example);

Python

def Example():
	red = 65535
	green = 0
	blue = 0
	color = vs.RGBToColorIndex(red, green, blue)
	vs.Rect(0, 0, 1, 1)
	vs.SetPenFore(vs.LNewObj(), color)
	vs.DSelectAll()
	criteria = vs.Concat('(INSYMBOL & INVIEWPORT & (PF=', color, '))')
	vs.SelectObj(criteria)
	vs.Message(criteria)
	vs.DeleteObjs()
Example()

Version

Availability: from All Versions

See Also

VS Functions:

VS:RRect

VS Functions: [[VS:RRect]]