ActLayer Layers 

Declaration:

FUNCTION   ActLayer
:HANDLE ;

Description:

Function ActLayer returns a handle to the currently active layer in a document.

See Also:

ActiveClass   ActSymDef   GetLName  



  CopyMode Layers 

Declaration:

PROCEDURE   CopyMode
( mode:INTEGER ) ;

Description:

Procedure CopyMode sets the transfer mode for the active design layer. If a sheet layer is active, the procedure has no effect.

Transfer Modes

Transfer Mode Index Value
Copy 8
OR 9
XOR 10
BIC 11
Inverse Copy 12
Inverse OR 13
Inverse XOR 14
Inverse BIC 15


The design layer will only be imaged with the transfer mode on systems which support it, like Windows. Setting the transfer mode to a mode other than Copy (i.e. 8, Paint mode), when the current layer transparency percentage is 0, will also automatically change the layer transparency percentage to 50. Similarly, setting the transfer mode to Copy, when the current layer transparency percentage is greater than 0, will also automatically change the layer transparency percentage to 0. This is to approximately preserve the appearance of the layer on systems that don't support transfer modes, like Quartz on the Mac.

Parameters:

mode Mode index value.

See Also:

SetLayerTransparency  



  CreateLayer Layers 

Declaration:

FUNCTION   CreateLayer
(   layerName :STRING;
    layerType :INTEGER
) :HANDLE ;

Description:

Creates a layer of the specified type.

layerType values:
Design = 1
Presentation = 2



  DisplayLayerScaleDialog Layers 

Declaration:

PROCEDURE   DisplayLayerScaleDialog
;

Description:

Brings up the Layer Scale dialog.



  FLayer Layers 

Declaration:

FUNCTION   FLayer
:HANDLE ;

Description:

Function FLayer returns a handle to the first layer in a Vectorworks document.




  GetLayer Layers 

Declaration:

FUNCTION   GetLayer
( h:HANDLE ) :HANDLE ;

Description:

Function GetLayer returns a handle to the layer of the referenced object.

Parameters:

h Handle to object.

Example:

LayerHandle:=GetLayer(ObjHd);



  GetLayerByName Layers 

Declaration:

FUNCTION   GetLayerByName
( layerName:STRING ) :HANDLE ;

Description:

Returns a handle to the specified layer.

Parameters:

layerName Name of layer.

Result:

Returns a HANDLE to the layer.



  GetLayerElevation Layers 

Declaration:

PROCEDURE   GetLayerElevation
(   h :HANDLE;
  VAR  baseElev :REAL;
  VAR  thickness :REAL
) ;

Description:

Gets the elevation and thickness of the specified layer.

Parameters:

h Handle to the layer
baseElev Base elevation of the layer
thickness Thickness of the layer

Example:

PROCEDURE Example;
VAR
	h :HANDLE; 
	baseElev, thickness :REAL;
BEGIN
	h := FLayer;
	WHILE h <> NIL DO BEGIN
		GetLayerElevation(h, baseElev, thickness);
		thickness := thickness / (25.4 / GetPrefReal(152));
		AlrtDialog(Concat('layer name: ', GetLName(h), ', baseElev: ', baseElev, ', thickness: ', thickness));
		h := NextLayer(h);
	END;
END;
RUN(Example);

See Also:

SetLayerElevation  



  GetLayerOptions Layers 

Declaration:

FUNCTION   GetLayerOptions
:INTEGER ;

Description:

Returns layer visibility setting for the active document.

Visibility Index
Active Only 1
Gray Others 2
Gray/Snap Others 6
Show Others 3
Show/Snap Others 4
Show/Snap/Modify Others 5

Result:

Returns an INTEGER indicating the layer visibility status of the document.

See Also:

SetLayerOptions  



  GetLayerRenderMode Layers 

Declaration:

FUNCTION   GetLayerRenderMode
( theLayer:HANDLE ) :INTEGER ;

Description:

Returns the render mode for the referenced layer.

Table - Render Modes

Render Mode Constant
Wireframe 0
Unshaded Polygon 2
Shaded Polygon 3
Shaded Polygon No Lines 4
Final Shaded Polygon 5
Hidden Line 6
Dashed Hidden Line 7
OpenGL 11
Fast RenderWorks 12
Fast RenderWorks with Shadows 13
Final Quality Renderworks 14
Custom Renderworks 15



  GetLName Layers 

Declaration:

FUNCTION   GetLName
( h:HANDLE ) :STRING ;

Description:

Function GetLName returns the name of the referenced layer.

Parameters:

h Handle to layer.



  GetLScale Layers 

Declaration:

FUNCTION   GetLScale
( h:HANDLE ) :REAL ;

Description:

Function GetLScale returns the scale of the referenced layer.

Parameters:

h Handle to layer.



  GetLVis Layers 

Declaration:

FUNCTION   GetLVis
( h:HANDLE ) :INTEGER ;

Description:

Function GetLVis returns the visibility of the referenced layer.

Table - Layer Visibility

Visibility Index Value
Normal 0
Grayed 2
Invisible -1

Parameters:

h Handle to layer.

Example:

FUNCTION GetLayerVisibility(layerHandle :handle) :INTEGER;
	{Returns the effective visibility of a layer.}
BEGIN
	GetLayerVisibility := -1;
	IF layerHandle = ActLayer THEN GetLayerVisibility := 0 ELSE {Active layers are always visible.}
	IF (GetObjectVariableInt(ActLayer, 154) = 1) & (GetObjectVariableInt(layerHandle, 154) = 1) THEN BEGIN
		{If it's not the active layer, then the only way that it can be visible is if
		the active layer is a design layer, and so is layerHandle, and the combination
		of layer options and the layer's visibility will result in a visible layer.}
		IF (GetLayerOptions = 2) & (GetLVis(layerHandle) = 2) THEN GetLayerVisibility := 2 ELSE
		IF (GetLayerOptions = 2) & (GetLVis(layerHandle) = 0) THEN GetLayerVisibility := 2 ELSE
		IF (GetLayerOptions > 2) & (GetLVis(layerHandle) = 2) THEN GetLayerVisibility := 2 ELSE
		IF (GetLayerOptions > 2) & (GetLVis(layerHandle) = 0) THEN GetLayerVisibility := 0;
	END;
END;


PROCEDURE Example;
BEGIN
	Message(GetLVis(GetLayerByName('Layer-1')));
END;
RUN(Example);



  GetSheetLayerUserOrigin Layers 

Declaration:

FUNCTION   GetSheetLayerUserOrigin
(   layerHandle :HANDLE;
  VAR  xOrigin :REAL;
  VAR  yOrigin :REAL
) :BOOLEAN ;

Description:

Gets the user origin of the specified sheet layer.

Parameters:

layerHandle Handle of the layer.
xOrigin X component of the sheet layer user origin.
yOrigin Y component of the sheet layer user origin.



  GetZVals Layers 

Declaration:

PROCEDURE   GetZVals
( VAR  zVal :REAL;
  VAR  deltaZVal :REAL
) ;

Description:

Procedure GetZVals returns the Z (layer base elevation) and delta Z (layer thickness) values for the active layer.

Parameters:

zVal Layer base elevation(above document ground plane).
deltaZVal Layer thickness.

Example:

PROCEDURE GetLayerHeights(layerHandle :handle; var baseElev, thickness :REAL);
BEGIN
	GetLayerElevation(layerHandle, baseElev, thickness);
	baseElev  := baseElev  / (25.4 / GetPrefReal(152));
	thickness := thickness / (25.4 / GetPrefReal(152));
END;



  GrayLayer Layers 

Declaration:

PROCEDURE   GrayLayer
;

Description:

Procedure GrayLayer sets the visibility status of the active layer to grayed. Objects on grayed layers will always appear grayed when viewed from other layers.


Example:

Layer('Future Construction');
GrayLayer;
{grays the layer 'Future Construction'}



  HideLayer Layers 

Declaration:

PROCEDURE   HideLayer
;

Description:

Procedure HideLayer sets the visibility status of the active layer to hidden. Objects on hidden layers will not be viewable from other layers.

Example:

Layer('Future Construction');
HideLayer;
{hides the layer 'Future Construction'}



  IsLayerReferenced Layers 

Declaration:

FUNCTION   IsLayerReferenced
(   layer :HANDLE;
  VAR  pathname :STRING
) :BOOLEAN ;

Description:

Returns whether a layer is workgroup referenced, and if so, the path to the source document is returned.

Parameters:

layer Handle to the layer
pathname On return, a string containing the path to the source document

Result:

Returns true if the layer is referenced, false otherwise.



  Layer Layers 

Declaration:

PROCEDURE   Layer
( name:STRING ) ;

Description:

Procedure Layer creates a new layer in a Vectorworks document. After creation, the new layer becomes the active layer of the document.

Layer can also be used to switch the active layer of the document. If the layer name passed to the procedure already exists, the procedure switches the active layer to the specified layer.

Single quotes should be avoided in layer names, as they will be treated as a mismatched string specifier, and will cause an error to be generated.

Parameters:

name Name of new or existing layer.

Example:

Layer('Ductwork-1st Floor');
{creates a new layer named 'Ductwork-1st Floor'}

Layer(newLayerName);
{creates a new layer whose name is specified in the variable}

Layer('Untitled-1');
{switches to the existing layer 'Untitled-1'}



  LayerRef Layers 

Declaration:

PROCEDURE   LayerRef
( layerName:STRING ) ;

Description:

Procedure LayerRef places a layer reference (layer link) into the active layer at location (0,0).

Parameters:

layerName Name of referenced layer.

Example:

LayerRef('Layer-2');
{creates a layer link of 'Layer-2' on the active layer}



  LFillBack Layers 

Declaration:

PROCEDURE   LFillBack
(   colorR :LONGINT;
    colorG :LONGINT;
    colorB :LONGINT
) ;

Description:

Procedure LFillBack sets the background fill color for the active layer. RGB values are in the range of 0~65535.

Parameters:

color RGB color component value.

Example:

LFillBack(65535,0,39321);



  LFillFore Layers 

Declaration:

PROCEDURE   LFillFore
(   colorR :LONGINT;
    colorG :LONGINT;
    colorB :LONGINT
) ;

Description:

Procedure LFillFore sets the foreground fill color for the active layer. RGB values are in the range of 0~65535.

Parameters:

color RGB color component value.

Example:

LFillFore(65535,0,39321);



  LLayer Layers 

Declaration:

FUNCTION   LLayer
:HANDLE ;

Description:

Function LLayer returns a handle to the last layer in a Vectorworks document.




  LPenBack Layers 

Declaration:

PROCEDURE   LPenBack
(   colorR :LONGINT;
    colorG :LONGINT;
    colorB :LONGINT
) ;

Description:

Procedure LPenBack sets the background pen color for the active layer. RGB values are in the range of 0~65535.

Parameters:

color RGB color component value.



  LPenFore Layers 

Declaration:

PROCEDURE   LPenFore
(   colorR :LONGINT;
    colorG :LONGINT;
    colorB :LONGINT
) ;

Description:

Procedure LPenFore sets the foreground pen color for the active layer. RGB values are in the range of 0~65535.

Parameters:

color RGB color component value.



  NumLayers Layers 

Declaration:

FUNCTION   NumLayers
:INTEGER ;

Description:

Function NumLayers returns the current number of layers within the active document.




  NumObj Layers 

Declaration:

FUNCTION   NumObj
( h:HANDLE ) :LONGINT ;

Description:

Function NumObj returns the number of objects on the referenced layer.

Parameters:

h Handle to layer.



  SetLayerElevation Layers 

Declaration:

PROCEDURE   SetLayerElevation
(   h :HANDLE;
    baseElev :REAL;
    thickness :REAL
) ;

Description:

Sets the elevation and thickness of the specified layer.

Parameters:

h Handle to the layer
baseElev Base elevation of the layer
thickness Thickness of the layer

See Also:

GetLayerElevation  



  SetLayerOptions Layers 

Declaration:

PROCEDURE   SetLayerOptions
( layerOpts:INTEGER ) ;

Description:

Sets layer visibility setting for the active document.

Visibility Index
Active Only 1
Gray Others 2
Gray/Snap Others 6
Show Others 3
Show/Snap Others 4
Show/Snap/Modify Others 5

Parameters:

layerOpts New layer visibility setting for document.

See Also:

GetLayerOptions  



  SetLayerRenderMode Layers 

Declaration:

PROCEDURE   SetLayerRenderMode
(   theLayer :HANDLE;
    newRenderMode :INTEGER;
    immediate :BOOLEAN;
    doProgress :BOOLEAN
) ;

Description:

Sets the render mode of the referenced layer.

Parameters:

theLayer Handle of the layer
newRenderMode New render mode to set
immediate If true, then all rendering will take place before the call returns. Otherwise, any rendering that can take place in the background will be postponed until program execution re-enters the main event loop
doProgress controls whether progress information is displayed during the operation



  SetLayerTransparency Layers 

Declaration:

PROCEDURE   SetLayerTransparency
( transparency:REAL ) ;

Description:

Procedure SetLayerTransparency assigns a transparency percentage value to the active design layer. If a sheet layer is active, the procedure has no effect. The transparency value must be between 0.0 and 100.0, inclusive.

The design layer will only be imaged with transparency on systems which support it, like Quartz on the Mac. Setting the transparency to a value greater than 0, when the current transfer mode is Copy (i.e. 8, Paint mode), will also automatically change the layer transfer mode to OR (i.e. 9, Overlay). Similarly, setting the transparency to 0, when the current transfer mode is not set to Copy, will also automatically change the layer transfer mode to Copy. This is to approximately preserve the appearance of the drawing when imaging on systems that don't support transparency, like Windows.

See Also:

CopyMode  



  SetLScale Layers 

Declaration:

PROCEDURE   SetLScale
(   h :HANDLE;
    scale :REAL
) ;

Description:

Procedure SetLScale sets the scale of the referenced layer.

Calculating the Scale

To calculate the scale parameter from an architecural scale, the following formula may be used :

denominator/numerator * true size(in inches) = ActualSize

For example, to calculate a scale of 3/8"=1'-0", the scale parameter would be 8/3 *12 = 32.

Parameters:

h Handle to layer.
scale Scale value for layer.

Example:

SetLScale(HandleToLayer,96);
{sets the referenced layer to a scale of 1/8" = 1'}



  SetScale Layers 

Declaration:

PROCEDURE   SetScale
( actualSize:REAL ) ;

Description:

Procedure SetScale sets the drawing scale of the active layer of the document.

Calculating the Scale

To calculate the scale parameter from an architecural scale, the following formula may be used :

denominator/numerator * true size(in inches) = ActualSize

For example, to calculate a scale of 3/8"=1'-0", the scale parameter would be 8/3 *12 = 32.

Parameters:

actualSize Drawing scale factor.



  SetSheetLayerUserOrigin Layers 

Declaration:

FUNCTION   SetSheetLayerUserOrigin
(   layerHandle :HANDLE;
    xOrigin :REAL;
    yOrigin :REAL
) :BOOLEAN ;

Description:

Sets the user origin of the specified sheet layer.



  SetZVals Layers 

Declaration:

PROCEDURE   SetZVals
(   zDistance :REAL;
    deltaZDistance :REAL
) ;

Description:

Procedure SetZVals sets the Z (layer base elevation) and delta Z (layer thickness) for the active layer.

Parameters:

zDistance Layer base elevation (above document ground plane).
deltaZDistance Layer thickness.

Example:

PROCEDURE Example;
VAR
   baseElevation, thickness :REAL;
BEGIN
   Layer('Test Layer');
   baseElevation := 1;
   thickness := 3;
   SetZVals(baseElevation, thickness);
END;
RUN(Example);



  ShowLayer Layers 

Declaration:

PROCEDURE   ShowLayer
;

Description:

Procedure ShowLayer sets the visibility status of the active layer to visible. Newly created layers always defaulted to the Show mode.

Example:

Layer('Future Construction');
ShowLayer;