VS:GetEnabledModules

From Vectorworks Developer
Jump to navigation Jump to search

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

Description

Determines which combination of product modules are currently enabled.

This function returns a LONGINT value which contains a bit for each possible product module. If a module is enabled, then the corresponding bit will be set to 1. If that module is disabled, then its bit will be 0. The table below contains selectors that can be used to interpret the results of this function. To determine if a module is enabled, do a bitwise "and" operation with the selector and the value returned by this function. See the usage example below.

Table - GetEnabledModules Selectors
Module Selector Description
Foundation 0 VectorWorks general purpose CAD.
RenderWorks 1 Advanced rendering features, lighting, textures.
Architect 2 Architectural features including advanced window, door, wall framing, HVAC
Landmark 4 Site modeling and landscape design module.
Spotlight 8 Theater lighting, set, and scenic design features.
Mechanical 16 Mechanical engineering module for designers and fabricators.
Pro 32 Foundation for European market.
FUNCTION GetEnabledModules : LONGINT;
def vs.GetEnabledModules():
    return LONGINT

Return Value

A LONGINT bitfield value with a bit for each possible product module.

Example

VectorScript

PROCEDURE testModules;

{----------------------------------------------------------}
FUNCTION bittest(value, mask :LONGINT) :BOOLEAN; 
VAR 
bit :INTEGER; 
BEGIN 
bittest := FALSE; 
bit := 31;    { 2 ^ 31 is high order bit of a LONGINT argument. }
WHILE ((bit > -1) & (bittest = false)) DO BEGIN 
IF value >= (2 ^ bit) THEN BEGIN 
value := value - (2 ^ bit); 
IF (2 ^ bit) = mask THEN bittest := TRUE; 
END; 
bit := bit - 1; 
END; 
END; 


{----------------------------------------------------------}
FUNCTION IsModuleEnabled(whichModule :LONGINT) :BOOLEAN; 
VAR 
enabledModules :LONGINT; 
BEGIN 
enabledModules := GetEnabledModules; 
IsModuleEnabled := bittest(enabledModules, whichModule)
END; 


BEGIN
IF IsModuleEnabled(4) & IsModuleEnabled(1)  THEN BEGIN
{ Landmark and Renderworks are both enabled. } 
{ ... }
END;
END;
RUN(testModules);

Python


def bittest (value, mask):
    bittest_result = False 
    
    bit = 31    #{ 2 ** 31 is high order bit of a LONGINT argument. }
    
    while ((bit > -1) and (bittest_result == False)):
        if value >= (2 ** bit):
            value = value - (2 ** bit) 
            if (2 ** bit) == mask:
                bittest_result = True 
        bit = bit - 1
         
    return bittest_result

#{----------------------------------------------------------}
def IsModuleEnabled(whichModule): 
	enabledModules = vs.GetEnabledModules()
	IsModuleEnabled = bittest(enabledModules, whichModule)
	return IsModuleEnabled

def testModules():
	if IsModuleEnabled(4) and IsModuleEnabled(1):
		pass
		#{ Landmark and Renderworks are both enabled. } 
		#{ ... }

testModules()

Version

Availability: from VectorWorks 10.0

See Also

VS Functions:

VS:DisableModules

VS Functions: [[VS:DisableModules]]