AddHole Objects - 2D 
VectorWorks10.1

VectorScript Declaration:

FUNCTION   AddHole
( VAR  objectToGetHole :HANDLE;
    holeTemplate :HANDLE
) :BOOLEAN ;

Python:

def  vs.AddHole(objectToGetHole, holeTemplate):
   return (BOOLEAN, objectToGetHole)

Description:

AddHole uses a holeTemplate to create a hole inside objectToGetHole. Upon success, objectToGetHole is converted to polyline. holeTemplate is unchanged.

Parameters:

objectToGetHole A 2D object to be cut by holeTemplate.
holeTemplate A 2D object to cut a hole out of objectToGetHole.

Example:

PROCEDURE AddHoleExample;
VAR
	h1, h2 :HANDLE;
BEGIN
	CallTool(-204);
	h1 := FSActLayer;
	CallTool(-204);
	h2 := FSActLayer;
	IF AddHole(h1, h2) THEN SetFPat(h1, 3);
END;
RUN(AddHoleExample);



  AddSurface Objects - 2D 
VectorWorks8.5

VectorScript Declaration:

FUNCTION   AddSurface
(   s1 :HANDLE;
    s2 :HANDLE
) :HANDLE ;

Python:

def  vs.AddSurface(s1, s2):
   return HANDLE

Description:

Creates a new surface object by combining the two referenced surface objects. If the combination is successful (if the objects overlap), it deletes the original surface objects and returns the handle of the resultant object.

Parameters:

s1 Handle to object.
s2 Handle to object.

Result:

Returns a HANDLE to a new surface object.

Example:

PROCEDURE AddSurfaceExample;
VAR
	h1, h2, h3 :HANDLE;
BEGIN
	DSelectAll;
	CallTool(-203);
	h1 := FSActLayer;
	DSelectAll;
	CallTool(-203);
	h2 := FSActLayer;
	h3 := AddSurface(h1, h2);
	IF h3 <> nil THEN SetFPat(h3, 5);
END;
RUN(AddSurfaceExample);

See Also:

ClipSurface  



  Arc Objects - 2D 
MiniCAD

VectorScript Declaration:

PROCEDURE   Arc
(   p1X :REAL;
    p1Y :REAL;
    p2X :REAL;
    p2Y :REAL;
    StartAngle :REAL;
    ArcAngle :REAL
) ;

Python:

def  vs.Arc(p1, p2, StartAngle, ArcAngle):
   return None

Description:

Procedure Arc creates an arc object, or a polyline object, in the active document. If p1 and p2 define a perfect square, an arc will be created, with its center point at the center of the square. If p1 and p2 define a rectangle, a polyline will be created which will represent the oval segment defined by the rectangle.

Parameters:

p1 Top left coordinate of bounding box of oval defining the arc.
p2 Bottom right coordinate of bounding box of oval defining the arc.
StartAngle Start angle of drawn arc.
ArcAngle Sweep angle of drawn arc.

Example:

Arc(0,0,2,2,45,90);
{draws an 90 degree arc with a start angle of 45 degrees}




  ArcByCenter Objects - 2D 
VectorWorks10.0

VectorScript Declaration:

PROCEDURE   ArcByCenter
(   x :REAL;
    y :REAL;
    radius :REAL;
    startAngl :REAL;
    sweepAngle :REAL
) ;

Python:

def  vs.ArcByCenter(x, y, radius, startAngl, sweepAngle):
   return None

Description:

Creates an arc using a center point, the radius, a start angle, and a sweep.

Parameters:

x X-coordinate of the center point
y Y-coordinate of the center point
radius Radius of the arc
startAngl Starting angle of the arc
sweepAngle Sweep angle of the arc

Example:

PROCEDURE Example;
VAR
	x, y, radius, startAngle, sweepAngle :REAL;
BEGIN
	GetPt(x, y);
	radius := 3;
	startAngle := 0;
	sweepAngle := 90;
	ArcByCenter(x, y, radius, startAngle, sweepAngle);
	AlrtDialog(Concat(GetType(LNewObj)));
END;
RUN(Example);



  ClipSurface Objects - 2D 
VectorWorks8.5

VectorScript Declaration:

PROCEDURE   ClipSurface
(   s1 :HANDLE;
    s2 :HANDLE
) ;

Python:

def  vs.ClipSurface(s1, s2):
   return None

Description:

Creates a new surface object by subtracting the intersection of surfaces s1 and s2 from s1.

Parameters:

s1 Handle to object.
s2 Handle to object.

Example:

PROCEDURE ClipSurfaceExample;
VAR
	h1, h2, h3 :HANDLE;
BEGIN
	DSelectAll;
	CallTool(-203);
	h1 := FSActLayer;
	DSelectAll;
	CallTool(-203);
	h2 := FSActLayer;
	ClipSurface(h1, h2);
	h3 := PrevObj(h2);
	IF h3 <> h1 THEN SetFPat(h3, 5);
END;
RUN(ClipSurfaceExample);



  CombineIntoSurface Objects - 2D 
VectorWorks10.1

VectorScript Declaration:

FUNCTION   CombineIntoSurface
(   ptX :REAL;
    ptY :REAL
) :HANDLE ;

Python:

def  vs.CombineIntoSurface(pt):
   return HANDLE

Description:

Creates a polyline from the bounded selection surrounding the inIncludedPoint.

Parameters:

pt A point within the bounded selection.



  Create2DObjShadow Objects - 2D 
Vectorworks 2014

VectorScript Declaration:

FUNCTION   Create2DObjShadow
(   h :HANDLE;
    offsetVecX :REAL;
    offsetVecY :REAL
) :HANDLE ;

Python:

def  vs.Create2DObjShadow(h, offsetVec):
   return HANDLE

Description:

Create a shadow representation of the given 2D object at the specified offset vector.

Parameters:

h Handle to a 2D object.
offsetVec Shadow direction and length.



  CreateRenderBkg Objects - 2D 
Vectorworks 2013

VectorScript Declaration:

FUNCTION   CreateRenderBkg
( Background:INTEGER ) :HANDLE ;

Python:

def  vs.CreateRenderBkg(Background):
   return HANDLE

Parameters:

Background Background is the type of background the function should rerturn. 0 returns a background with no shader attached. 1 returns a cloud background 2 returns a one color background 3 returns a two color background 4 returns a physical sky background.



  CreateRWBackground Objects - 2D 
Vectorworks 2009

VectorScript Declaration:

FUNCTION   CreateRWBackground
( imageResource:HANDLE ) :HANDLE ;

Python:

def  vs.CreateRWBackground(imageResource):
   return HANDLE

Description:

Creates a Renderworks Background resource using the image from an existing Image resource. Width and height are set to default sizes relative to the page size.



  GetArc Objects - 2D 
MiniCAD

VectorScript Declaration:

PROCEDURE   GetArc
(   h :HANDLE;
  VAR  startAngleR :REAL;
  VAR  arcAngleR :REAL
) ;

Python:

def  vs.GetArc(h):
   return (startAngleR, arcAngleR)

Description:

Procedure GetArc returns the start and sweep angle of the referenced arc or round wall.

Parameters:

h Handle to arc.
startAngleR Returns start angle of arc.
arcAngleR Returns sweep angle of arc.

Example:

PROCEDURE GetArcSetArcExample;
VAR
	h :HANDLE;
	startAng, sweepAng :REAL;
BEGIN
	h := FSActLayer;
	GetArc(h, startAng, sweepAng);
	SetArc(h, startAng, sweepAng + 10);
END;
RUN(GetArcSetArcExample);



  GetLocPt Objects - 2D 
MiniCAD

VectorScript Declaration:

PROCEDURE   GetLocPt
(   h :HANDLE;
  VAR  pX :REAL;
  VAR  pY :REAL
) ;

Python:

def  vs.GetLocPt(h):
   return p

Description:

Procedure GetLocPt returns the coordinate location of the referenced locus.

Parameters:

h Handle to locus.
p Coordinates of locus point.



  GetRRDiam Objects - 2D 
MiniCAD

VectorScript Declaration:

PROCEDURE   GetRRDiam
(   h :HANDLE;
  VAR  xDiam :REAL;
  VAR  yDiam :REAL
) ;

Python:

def  vs.GetRRDiam(h):
   return (xDiam, yDiam)

Description:

Procedure GetRRDiam returns the horizontal and vertical diameters of the rounded corners of a rounded rectangle object.

Parameters:

h Handle to object.
xDiam X diameter of rounded corner.
yDiam Y diameter of rounded corner.



  GetSegPt1 Objects - 2D 
MiniCAD

VectorScript Declaration:

PROCEDURE   GetSegPt1
(   h :HANDLE;
  VAR  pX :REAL;
  VAR  pY :REAL
) ;

Python:

def  vs.GetSegPt1(h):
   return p

Description:

Procedure GetSegPt1 returns the X-Y coordinates of the start point of the referenced line, wall, or linear dimension object.

Parameters:

h Handle to line.
p Coordinates of start point.



  GetSegPt2 Objects - 2D 
MiniCAD

VectorScript Declaration:

PROCEDURE   GetSegPt2
(   h :HANDLE;
  VAR  pX :REAL;
  VAR  pY :REAL
) ;

Python:

def  vs.GetSegPt2(h):
   return p

Description:

Procedure GetSegPt2 returns the end point of the of the referenced line, wall, or linear dimension object.

Parameters:

h Handle to line.
p Coordinates of end point.



  IntersectSurface Objects - 2D 
VectorWorks8.5

VectorScript Declaration:

FUNCTION   IntersectSurface
(   s1 :HANDLE;
    s2 :HANDLE
) :HANDLE ;

Python:

def  vs.IntersectSurface(s1, s2):
   return HANDLE

Description:

Creates new surface objects that are the intersection of the two referenced surface objects. The original surface objects are not modified. The new objects get "inserted" into the drawing list, after s2, and before the next object after that.

Parameters:

s1 Handle to object.
s2 Handle to object.

Result:

Returns a HANDLE to the new surface object, or to a group containing multiple surface objects.

Example:

PROCEDURE Example;
VAR
	h1, h2, h3, h4 :HANDLE;
	pt :VECTOR;
BEGIN
	h1 := NIL;
	WHILE h1 = NIL DO BEGIN
		Message('Pick the first object...');
		GetPt(pt.x, pt.y);
		h1 := PickObject(pt.x, pt.y);
	END;
	h2 := NIL;
	WHILE h2 = NIL DO BEGIN
		Message('Pick the second object...');
		GetPt(pt.x, pt.y);
		h2 := PickObject(pt.x, pt.y);
	END; 

	{Capture the handle of the next object.}
   	h3 := NextObj(h2);

	{Now create the intersection surface(s).}
	h4 := IntersectSurface(h1, h2);

	{Now find the intersection surface(s).}
	WHILE h4 <> h3 DO BEGIN
		SetFPat(h4, 3);
		h4 := NextObj(h4);
	END;
	ClrMessage;
END;
RUN(Example);



  Line Objects - 2D 
MiniCAD

VectorScript Declaration:

PROCEDURE   Line
(   lineDX :REAL;
    lineDY :REAL
) ;

Python:

def  vs.Line(line):
   return None

Description:

Procedure Line creates a line object in Vectorworks. The line is drawn from the current pen position(x,y) to the specified point. The point may also be thought of as the location (x+dX,y+dY), where dX and dY are x and y offsets, respectively.

The line object is drawn with the current default attributes unless otherwise specified.

Parameters:

line Offset values for line.

Example:

Line(2,2);
{ draws a line from the current pen location to a point }
{ 2 horizontal and 2 vertical units away.               }



  LineTo Objects - 2D 
MiniCAD

VectorScript Declaration:

PROCEDURE   LineTo
(   pX :REAL;
    pY :REAL
) ;

Python:

def  vs.LineTo(p):
   return None

Description:

Procedure LineTo creates a line object in the document. LineTo draws from the current graphics pen position to the specified coordinate location. The line object is drawn with the current default attributes unless otherwise specified in the VectorScript routine.

Parameters:

p Line endpoint.

Example:

LineTo(3,4);
{draws a line from the current pen position to (3,4)}

See Also:

Absolute   Relative  



  Locus Objects - 2D 
MiniCAD

VectorScript Declaration:

PROCEDURE   Locus
(   pX :REAL;
    pY :REAL
) ;

Python:

def  vs.Locus(p):
   return None

Description:

Procedure Locus creates a 2D locus object at the specified coordinate location.

Parameters:

p Coordinate location of new locus.

Example:

PROCEDURE Example;
VAR
	x, y :REAL;
BEGIN
	HCenter(FSActLayer, x, y);
	Locus(x, y);
END;
RUN(Example);



  MakePolygon Objects - 2D 
VectorWorks10.1

VectorScript Declaration:

FUNCTION   MakePolygon
( inSourceObject:HANDLE ) :HANDLE ;

Python:

def  vs.MakePolygon(inSourceObject):
   return HANDLE

Description:

MakePolygon creates a 2D Polygon using inSourceObject. Does not delete inSourceObject.

Parameters:

inSourceObject inSource object should be a 2D object that can be polygonalized.

Result:

A polygonalized copy of inSourceObject

Example:

PROCEDURE Example;
VAR
	h :HANDLE;
BEGIN
	CallTool(-204);
	h := FSActLayer;
	h := MakePolygon(h);
END;
RUN(Example);



  MakePolyline Objects - 2D 
VectorWorks10.1

VectorScript Declaration:

FUNCTION   MakePolyline
( inSourceObject:HANDLE ) :HANDLE ;

Python:

def  vs.MakePolyline(inSourceObject):
   return HANDLE

Description:

Creates a polyline using inSourceObject. inSourceObject is unchanged.

Parameters:

inSourceObject The 2D object from which to make a polyline.

Result:

A polyline representation of inSourceObject.

Example:

PROCEDURE Example;
VAR
	h,h2:HANDLE;
BEGIN
h:=FSActLayer;
h2 := MakePolyline(h);
DelObject(h);
END;
RUN(Example);



  ModelPt2DToScreenPt Objects - 2D 
VectorWorks 2008

VectorScript Declaration:

PROCEDURE   ModelPt2DToScreenPt
( VAR  pX :REAL;
  VAR  pY :REAL
) ;

Python:

def  vs.ModelPt2DToScreenPt(p):
   return p

Description:

Transforms a point from world coordinate to the screen coordinates in plan rotation.



  ModelVecToScreenVec Objects - 2D 
VectorWorks 2008

VectorScript Declaration:

PROCEDURE   ModelVecToScreenVec
( VAR  pX :REAL;
  VAR  pY :REAL
) ;

Python:

def  vs.ModelVecToScreenVec(p):
   return p

Description:

Takes Data from one space to another.



  Oval Objects - 2D 
MiniCAD

VectorScript Declaration:

PROCEDURE   Oval
(   p1X :REAL;
    p1Y :REAL;
    p2X :REAL;
    p2Y :REAL
) ;

Python:

def  vs.Oval(p1, p2):
   return None

Description:

Procedure Oval creates an oval object in a Vectorworks document.

Parameters:

p1 Top left coordinate of oval bounding box.
p2 Bottom right coordinate of oval bounding box.



  OvalN Objects - 2D 
VectorWorks 2008

VectorScript Declaration:

PROCEDURE   OvalN
(   orginX :REAL;
    orginY :REAL;
    directionX :REAL;
    directionY :REAL;
    width :REAL;
    height :REAL
) ;

Python:

def  vs.OvalN(orgin, direction, width, height):
   return None

Description:

Creates an oval with the specified bounds.

Example:

PROCEDURE Example;
BEGIN
	OvalN(0, 0, 1, 0, 1, 1);
END;
RUN(Example);



  Rect Objects - 2D 
MiniCAD

VectorScript Declaration:

PROCEDURE   Rect
(   p1X :REAL;
    p1Y :REAL;
    p2X :REAL;
    p2Y :REAL
) ;

Python:

def  vs.Rect(p1, p2):
   return None

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.


Parameters:

p1 Top left coordinate of rectangle.
p2 Bottom right coordinate of rectangle.

Example:

Rect(0,2,2,1);
{creates a rectangle object by coordinate values}

Rect(0.5,#90,2,#0);
{creates a rectangle object by dist-angle values}

See Also:

RRect  



  RectangleN Objects - 2D 
VectorWorks 2008

VectorScript Declaration:

PROCEDURE   RectangleN
(   orginX :REAL;
    orginY :REAL;
    directionX :REAL;
    directionY :REAL;
    width :REAL;
    height :REAL
) ;

Python:

def  vs.RectangleN(orgin, direction, width, height):
   return None

Description:

Creates and returns a handle to a new rectangle object with the specified bounds.

Example:

PROCEDURE Example;
BEGIN
	RectangleN(0, 0, 1, 0, 1, 1);
END;
RUN(Example);



  RRect Objects - 2D 
MiniCAD

VectorScript Declaration:

PROCEDURE   RRect
(   p1X :REAL;
    p1Y :REAL;
    p2X :REAL;
    p2Y :REAL;
    DiamDX :REAL;
    DiamDY :REAL
) ;

Python:

def  vs.RRect(p1, p2, Diam):
   return None

Description:

Procedure RRect creates a rounded rectangle object in a Vectorworks document.

Corner definition is controlled by parameter Diam, which determines the "roundness" of the rectangle corners. The X and Y components of Diam correspond to the major and minor axes of an oval defining the rectangle corner.

Parameters:

p1 Top left coordinate of rectangle.
p2 Bottom right coordinate of rectangle.
Diam X and Y diameters of corner.

Example:

PROCEDURE Example;
BEGIN
	RRect(0, 0, 1, 1, 0.25, 0.25);
	{same as: RRectangleN(0, 0, 1, 0, 1, 1, .25, .25);}
END;
RUN(Example);

See Also:

Rect   GetRRDiam  



  RRectangleN Objects - 2D 
VectorWorks 2008

VectorScript Declaration:

PROCEDURE   RRectangleN
(   orginX :REAL;
    orginY :REAL;
    directionX :REAL;
    directionY :REAL;
    width :REAL;
    height :REAL;
    xDiam :REAL;
    yDiam :REAL
) ;

Python:

def  vs.RRectangleN(orgin, direction, width, height, xDiam, yDiam):
   return None

Description:

Creates and returns a handle to a new rotated rectangle object with the specified bounds



  ScreenPtToModelPt2D Objects - 2D 
VectorWorks 2008

VectorScript Declaration:

PROCEDURE   ScreenPtToModelPt2D
( VAR  pX :REAL;
  VAR  pY :REAL
) ;

Python:

def  vs.ScreenPtToModelPt2D(p):
   return p

Description:

Transforms a point from screen coordinate in plan rotation to the model coordinates.

Parameters:

p Input output parameter. Coordinates of the point to be translated.



  ScreenVecToModelVec Objects - 2D 
VectorWorks 2008

VectorScript Declaration:

PROCEDURE   ScreenVecToModelVec
( VAR  pX :REAL;
  VAR  pY :REAL
) ;

Python:

def  vs.ScreenVecToModelVec(p):
   return p

Description:

Takes data from one space to another



  SetArc Objects - 2D 
MiniCAD

VectorScript Declaration:

PROCEDURE   SetArc
(   h :HANDLE;
    startAngle :REAL;
    arcAngle :REAL
) ;

Python:

def  vs.SetArc(h, startAngle, arcAngle):
   return None

Description:

Procedure SetArc sets the start and sweep angles of the referenced arc or round wall object. Specify the angles in degrees.

Parameters:

h Handle to arc.
startAngle New start angle of arc.
arcAngle New sweep angle of arc.

Example:

PROCEDURE GetArcSetArcExample;
VAR
	h :HANDLE;
	startAng, sweepAng :REAL;
BEGIN
	h := FSActLayer;
	GetArc(h, startAng, sweepAng);
	SetArc(h, startAng, sweepAng + 10);
END;
RUN(GetArcSetArcExample);



  SetSegPt1 Objects - 2D 
MiniCAD

VectorScript Declaration:

PROCEDURE   SetSegPt1
(   h :HANDLE;
    pX :REAL;
    pY :REAL
) ;

Python:

def  vs.SetSegPt1(h, p):
   return None

Description:

Procedure SetSegPt1 sets the location of the start point of the referenced line or wall object.

Parameters:

h Handle to line.
p New start point of line.

Example:

PROCEDURE ExtendLine;
CONST
   kEXTENSION = 250mm;

PROCEDURE ProcessLine(lineHdl :HANDLE);
VAR
   size :REAL;
   lineVec :VECTOR;
   arrow1,arrow2 :BOOLEAN;
   style,angle :INTEGER;
   p1X,p1Y,p2X,p2Y,lineLen :REAL;
BEGIN
   GetSegPt1(lineHdl, p1X, p1Y);
   GetSegPt2(lineHdl, p2X, p2Y);
   GetObjArrow(lineHdl, style, size, angle, arrow1, arrow2);
   IF arrow1 THEN BEGIN
      lineVec[1] := p1X - p2X;
      lineVec[2] := p1Y - p2Y;
      lineLen := Norm(lineVec);
      lineVec := (lineLen + kEXTENSION) * UnitVec(lineVec);
      p1X := p2X + lineVec[1];
      p1Y := p2Y + lineVec[2];
      SetSegPt1(lineHdl, p1X, p1Y);
   END ELSE BEGIN
      lineVec[1] := p2X - p1X;
      lineVec[2] := p2Y - p1Y;
      lineLen := Norm(lineVec);
      lineVec := (lineLen + kEXTENSION) * UnitVec(lineVec);
      p2X := p1X + lineVec[1];
      p2Y := p1Y + lineVec[2];
      SetSegPt2(lineHdl, p2X, p2Y);
   END;
END;

BEGIN
   ForEachObject(ProcessLine, (((C='LineClass') & (T=LINE))));
END;
RUN(ExtendLine);

See Also:

SetSegPt2  



  SetSegPt2 Objects - 2D 
MiniCAD

VectorScript Declaration:

PROCEDURE   SetSegPt2
(   h :HANDLE;
    pX :REAL;
    pY :REAL
) ;

Python:

def  vs.SetSegPt2(h, p):
   return None

Description:

Procedure SetSegPt2 sets the location of the end point of the referenced line or wall object.

Parameters:

h Handle to arc.
p New end point of line.

See Also:

SetSegPt1