### Example (Pascal) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetRecord.md Example of how to get a record handle in Pascal. ```pascal handleToRecord := GetRecord(handleToObject,3); ``` -------------------------------- ### Example (Python) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetRecord.md Example of how to get a record handle in Python. ```python handleToRecord = vs.GetRecord(handleToObject,3) ``` -------------------------------- ### Drag and Drop Setup Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Common/Tasks/Dialogs/List Browsers part 2.md Example code demonstrating how to set up drag and drop functionality for a List Browser, including setting the control type and enabling/disabling dropping on specific row ranges. ```Pascal { set up list browser } temp_b := EnableLBDragAndDrop(dlog, lb, TRUE); temp_b := SetLBDragDropColumn(dlog, lb, col); { set up column } temp_b := SetLBControlType(dlog, lb, col, 6); { control type: number } temp_b := EnableLBDropOnIndices(dlog, lb, 0, GetNumLBItems(dlog, lb), TRUE); { Supposing to have a LB with 2 rows, in order to avoid them to be moved before 1st item or after last item use this: } temp_b := EnableLBDropOnIndices(dlog, lb, -1, 2, FALSE); { two rows row index: 0 and 1 -1 is before row 0, 2 is after row 1 } ``` -------------------------------- ### Example Usage Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetLayerOptions.md Example of how to use GetLayerOptions. ```pascal Message(GetLayerOptions); ``` -------------------------------- ### Pascal Procedure Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/DBeam_BeginShttGet.md Starts the shutter get routine in Pascal. ```pascal PROCEDURE DBeam_BeginShttGet; ``` -------------------------------- ### Example Menu Commands Source: https://github.com/vectorworks/developer-scripting/blob/main/Common/Tasks/Info/Install Plugins into the Current Workspace.md This Python code demonstrates how to register new menu commands under a company-specific menu in Vectorworks. ```python vs.wsEditBegin('MyCompany') vs.wsEditAddMenu('VS_linear_Calc') vs.wsEditAddMenu('VS_Setup') vs.wsEditEnd(True) ``` -------------------------------- ### Manifest File Structure Source: https://github.com/vectorworks/developer-scripting/blob/main/Common/Partner Install/pages/Partner Product Install Package.md An example structure of a manifest file detailing product information and package relationships. ```xml NBS Chorus NBS Chorus The category The NBS Chorus integration enables users to access and dynamically link their models to the NBS online specification database, keeping the model as the central source of project information. Users will be able to open a web palette in Vectorworks, letting them work concurrently with their model and NBS Chorus. Any data modified in NBS Chorus via the web palette will update in the data record of the model, ensuring accurate and up-to-date specification information is accessible at all times from the model. The NBS Chorus integration is another step in creating a holistic BIM environment within Vectorworks. NBS Chorus integration will be available to users of Vectorworks Design Series products with an active membership in Vectorworks Service Select. Logo.png LogoThumbnail.png Vectorworks Inc. https://www.mycompnay.com support@mycompany.com Free 1.0 3/17/2020 InstallPackage2020Win.zip www.mycompany.com/external_installer.dmg ``` -------------------------------- ### Get Tool Information Source: https://github.com/vectorworks/developer-scripting/blob/main/Common/Partner Install/pages/Partner Product Install Package.md Returns tool information including display name, shortkey, resource ID, etc., at a specified index of the parent tool at a specified path. ```Python def vs.ws2GetToolInfo(toolPath): return BOOLEAN(Ok), DYNARRAY[] of CHAR(DisplayName), CHAR(Shortkey), INTEGER(ShortkeyModifier), INTEGER(ResourceID) ``` -------------------------------- ### Get Symbol Instance Location Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetSymbolOptionsN.md This example demonstrates how to get the left/right/center information for a symbol instance within a wall. ```pascal PROCEDURE Example; VAR wallInstance, symInstance :HANDLE; symLoc, wallBeg, wallEnd, relPt :VECTOR; FUNCTION DoSomeThing(h :HANDLE) :BOOLEAN; BEGIN IF GetType(h) = 15 THEN BEGIN symInstance := h; wallInstance := GetParent(h); END; END; BEGIN symInstance := NIL; ForEachObjectInLayer(DoSomeThing, 2, 2, 0); IF symInstance <> NIL THEN BEGIN GetSegPt1(wallInstance, wallBeg.x, wallBeg.y); GetSegPt2(wallInstance, wallEnd.x, wallEnd.y); GetSymLoc(symInstance, symLoc.x, symLoc.y); relPt := RelativeCoords(symLoc, wallBeg, wallEnd); IF relPt.y = 0 THEN Message('center') ELSE IF relPt.y < 0 THEN Message('right') ELSE IF relPt.y > 0 THEN Message('left'); END ELSE AlrtDialog('nil handle'); END; RUN(Example); ``` -------------------------------- ### Create Tool Source: https://github.com/vectorworks/developer-scripting/blob/main/Common/Partner Install/pages/Partner Product Install Package.md Creates a new tool. ```Python def vs.ws2CreateTool(toolPath, univName, resourceID): return BOOLEAN ``` -------------------------------- ### Example Usage Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/ShowEditTileSettingsDialog.md Demonstrates how to use ShowEditTileSettingsDialog to display an existing tile or create a new one. ```pascal ShowEditTileSettingsDialog(tileHandle); { displays the specified tile resource in the dialog } tileHandle := nil; ShowEditTileSettingsDialog(tileHandle); { creates a new tile resource and displays it in the dialog } ``` -------------------------------- ### VectorScript FileIO Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/examples/FileIO.md Demonstrates basic file operations like getting version, appending, writing, and closing a file in VectorScript. ```pascal PROCEDURE Example; VAR fileName :STRING; major, minor, maintenance, platform :INTEGER; BEGIN GetVersion(major, minor, maintenance, platform); IF platform = 1 THEN BEGIN fileName := 'Macintosh HD:Example.txt'; END ELSE BEGIN fileName := 'C:\Example.txt'; END; Append(fileName); WriteLn('example text'); Close(fileName); END; RUN(Example); ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/NumRecords.md Example of how to get the number of attached records in Python. ```python numAttached = vs.NumRecords(HandleToObject) ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetDefaultBeginningMarker.md Example of how to use GetDefaultBeginningMarker in Python. ```python def Example(): ok, style, angle, size, width, thickBasis, thickness, visibility = vs.GetDefaultBeginningMarker () vs.Message (style, ' / ', angle, ' / ', size, ' / ', width, ' / ', thickBasis, ' / ', thickness, ' / ', visibility) Example() ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/NumRecords.md Example of how to get the number of attached records in VectorScript. ```pascal numAttached:=NumRecords(HandleToObject); ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetZVals.md Example of how to get layer heights using VectorScript. ```Pascal 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; ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/BeginFloor.md Example of using BeginFloor in Python to create a floor. ```Python vs.BeginFloor(6) vs.Rect(1,1,5,5) vs.EndGroup() ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/PenBack.md Examples of using vs.PenBack with RGB values and Color Index values. ```python vs.PenBack((65535, 0, 39321)) # using RGB values colorIndex = vs.RGBToColorIndex(65535, 0, 39321) vs.PenBack(colorIndex) # using Color Index values ``` -------------------------------- ### Example Usage Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetTexMapIntN.md Example of how to use GetTexMapIntN to get the mapping type. ```python { _c_: returns the mapping type (plane, sphere, cylinder, perimeter) of the overall texture } GetTexMapIntN(obj, 3, 0, 1); ``` -------------------------------- ### Example Usage Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetFldFlag.md Example of how to use GetFldFlag to get the field type. ```python fieldType:=GetFldFlag(recordHandle,3); ``` -------------------------------- ### Create Tool Palette Source: https://github.com/vectorworks/developer-scripting/blob/main/Common/Partner Install/pages/Partner Product Install Package.md Creates a new tool palette if it does not already exist. ```Python def vs.ws2CreateToolPalette(univName, displayName): return BOOLEAN ``` -------------------------------- ### Example Usage (Pascal) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/CreateLight.md Example of how to use the CreateLight function in Pascal. ```pascal CreateLight(2, 3, 8, 1, TRUE, TRUE); ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetDashStyle.md Example of getting the current dash style in VectorScript. ```vectorscript currLS:=GetDashStyle; ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/ActSymDef.md Example of how to get the handle to the active symbol in Python. ```python def Example(): HandleToActiveSym = vs.ActSymDef() Example() ``` -------------------------------- ### Pascal Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetFolder.md Example of how to use the GetFolder function in Pascal. ```pascal PROCEDURE Example; VAR promptStr :STRING; directoryPath :STRING; result :INTEGER; BEGIN promptStr := 'Select the folder...'; directoryPath := GetFolderPath(3); result := GetFolder(promptStr, directoryPath); Message(directoryPath); END; Run(Example); ``` -------------------------------- ### Pascal Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetOSVersion.md Example of how to use GetOSVersion in Pascal. ```pascal PROCEDURE ShowVersionInfo; VAR osMajor, osMinor, osIncr :LONGINT; vwMajor, vwMinor, vwMaint, platform: INTEGER; str :STRING; BEGIN str := ''; GetOSVersion(osMajor, osMinor, osIncr); GetVersion(vwMajor, vwMinor, vwMaint, platform); If platform = 1 then BEGIN str := Concat(str, 'Platform: Macintosh', chr(13)); IF osMajor = 0 THEN osMajor := 10; str := Concat(str, 'OS Version: ', osMajor, '.', osMinor, '.', osIncr, chr(13)); end else if platform = 2 then BEGIN str := Concat(str, 'Platform: Windows', chr(13)); IF (osMajor = 4) & (osMinor = 10) THEN str := Concat(str, 'OS Version: 98 SE', chr(13)) ELSE IF (osMajor = 5) & (osMinor = 1) THEN str := Concat(str, 'OS Version: XP', chr(13)) ELSE str := Concat(str, 'OS Version: ', osMajor, '.', osMinor, '.', osIncr, chr(13)); END; str := Concat(str, 'VW Version: ', vwMajor, '.', vwMinor, '.', vwMaint); AlrtDialog(str); END; RUN(ShowVersionInfo); ``` -------------------------------- ### Pascal Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/ActSymDef.md Example of how to get the handle to the active symbol in Pascal. ```pascal PROCEDURE Example; VAR HandleToActiveSym : HANDLE; BEGIN HandleToActiveSym:=ActSymDef; END; RUN(Example); ``` -------------------------------- ### Init Properties Source: https://github.com/vectorworks/developer-scripting/blob/main/Common/Tasks/Parametrics/Plug-in with widget basic example.md Sets up the Object Info Palette behavior during the init properties event (event 5). This example shows how to enable UI override for the plug-in. ```python if theEvent == kObjOnInitXProperties: # event 5 # init event behaviour for the plug-in, for example: ok = vs.SetObjPropVS(kObjXPropHasUIOverride, True) # constant 8 ``` -------------------------------- ### Example Usage Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/ObjSurfAreaInWorldC.md Example of how to use ObjSurfaceAreaInWorldC to get the surface area of an object. ```pascal PROCEDURE Example; VAR volume, area: REAL; BEGIN IF FSActLayer <> NIL THEN BEGIN volume := CalcVolume(FSActLayer); area := ObjSurfaceAreaInWorldCoord(FSActLayer); Message('Volume ', volume, ', surface area ', area); END; END; RUN(Example); ``` -------------------------------- ### Get Tool at Index Source: https://github.com/vectorworks/developer-scripting/blob/main/Common/Partner Install/pages/Partner Product Install Package.md Returns the tool universal name at a specified index of the parent tool or tool set at a specified path. ```Python def vs.ws2GetToolAt(toolPath, index): return DYNARRAY[] of CHAR ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetScreen.md Example of how to use GetScreen in Python. ```python def Example(): x1, y1, x2, y2 = vs.GetScreen() vs.Message(x1,' ',y1,' ',x2,' ',y2); Example() ``` -------------------------------- ### Example (Python) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetPrefLongInt.md Example of using GetPrefLongInt in Python to get a preference setting. ```python convertRes2D = vs.GetPrefLongInt(55) ``` -------------------------------- ### Example (Pascal) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetPrefLongInt.md Example of using GetPrefLongInt in Pascal to get a preference setting. ```pascal convertRes2D:= GetPrefLongInt(55); ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/BeginFloor.md Example of using BeginFloor in VectorScript to create a floor. ```Pascal BeginFloor(6\"); Rect(1,1,5,5); EndGroup; ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetObjectVariableReal.md Example of using GetObjectVariableReal in Python to get a dimension offset. ```python dim_offset = vs.GetObjectVariableReal(h,4) ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/Open.md Example of opening a file, handling errors, and closing it. ```pascal PROCEDURE Example; VAR fileName :STRING; BEGIN UseDefaultFileErrorHandling(FALSE); fileName := 'Plug-InsCommonDataCallout Prefs.txt'; Open(fileName); AlrtDialog(Concat(GetLastFileErr)); Close(fileName); END; RUN(Example); ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetObjectVariableReal.md Example of using GetObjectVariableReal in VectorScript to get a dimension offset. ```vectorscript dim_offset:= GetObjectVariableReal(h,4); ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/EvalStr.md Example of using EvalStr in VectorScript to get a 'Serial No.' value. ```pascal dataValue:= EvalStr(handleToObject,('Part Info'.'Serial No.')); ``` -------------------------------- ### Example Usage Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/IFC_DefPsetImport2.md Demonstrates how to import custom object presets from a specified file path. ```pascal PROCEDURE PsetImport; VAR bOK : BOOLEAN BEGIN {We suggest that we are importing from an Presets.xml file that is located on D:\Vectorworks\Presets.xml} bOK := IFC_DefPsetImport2( 'D:\Vectorworks\Presets.xml'); END; RUN(PsetImport); ``` ```python # We suggest that we are importing from an Presets.xml file that is located on D:\Vectorworks\Presets.xml ok = vs.IFC_DefPsetImport2( 'D:\Vectorworks\Presets.xml'); ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/AngDialog.md Example of using AngDialog in Python to get an angle value. ```python AngleValue = vs.AngDialog('Enter an angle value:', '0d') ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetOSVersion.md Example of how to use GetOSVersion in Python. ```python import vs verStr = '' osVersion = vs.GetOSVersion() version = vs.GetVersion() osMajor = osVersion[0] osMinor = osVersion[1] osIncr = osVersion[2] vwMajor = version[0] vwMinor = version[1] vwMaint = version[2] platform = version[3] if platform == 1 : verStr = vs.Concat(verStr, 'Platform: Macintosh', chr(13)) if (osMajor == 0) : osMajor == 10 verStr = vs.Concat(verStr, 'OS Version: ', osMajor, '.', osMinor, '.', osIncr, chr(13)) elif platform == 2 : verStr = vs.Concat(verStr, 'Platform: Windows', chr(13)) if (osMajor == 4) & (osMinor == 10) : verStr = vs.Concat(verStr, 'OS Version: 98 SE', chr(13)) if (osMajor == 5) & (osMinor == 1) : verStr = vs.Concat(verStr, 'OS Version: XP', chr(13)) verStr = vs.Concat(verStr, 'OS Version: ', osMajor, '.', osMinor, '.', osIncr, chr(13)) verStr = vs.Concat(verStr, 'VW Version: ', vwMajor, '.', vwMinor, '.', vwMaint) vs.AlrtDialog(verStr) ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/AngDialog.md Example of using AngDialog in VectorScript to get an angle value. ```pascal AngleValue := AngDialog('Enter an angle value:', '0d'); ``` -------------------------------- ### Example (Pascal) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetObjBeginningMarker.md Example usage of GetObjBeginningMarker in Pascal. ```pascal PROCEDURE Example; VAR h: HANDLE; style: INTEGER; angle: INTEGER; size: REAL; width: REAL; thickBasis: INTEGER; thickness: REAL; visibility: BOOLEAN; ok : BOOLEAN; BEGIN h := FSActLayer; ok := GetObjBeginningMarker (h, style, angle, size, width, thickBasis, thickness, visibility); Message (style, ' / ', angle, ' / ', size, ' / ', width, ' / ', thickBasis, ' / ', thickness, ' / ', visibility); END; RUN(Example); ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/TopBound.md Example of using TopBound in VectorScript to get the y-coordinate of a bounding box. ```VectorScript TopBValue:=TopBound(N='MyRect'); ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/RealDialog.md Example of using RealDialog in Python to get a real value from the user. ```python realValue = vs.RealDialog('Enter a real value', '0.00') ``` -------------------------------- ### QTInitialize Python Function Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/QTInitialize.md Initializes QuickTime and returns the QuickTime version number. ```python def vs.QTInitialize(): return INTEGER ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/RealDialog.md Example of using RealDialog in VectorScript to get a real value from the user. ```pascal RealValue:=RealDialog('Enter a real value:','0.00'); ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/BeginFolder.md This example demonstrates how to create a symbol folder named 'Object Symbols' and add a symbol named 'Oval Symbols' within it, including setting pen and fill attributes and drawing an oval. ```Pascal NameObject('Object Symbols'); BeginFolder; BeginSym('Oval Symbols'); PenSize(14); PenPat(2); FillPat(1); FillFore(0,0,0); FillBack(65535,65535,65535); PenFore(0,0,0); PenBack(65535,65535,65535); Oval(-1/4",1/4",3/4",-3/4"); EndSym; EndFolder; {creates the symbol folder 'Object Symbols', which contains a symbol} ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/BeginMXtrd.md Example of using vs.BeginMXtrd to create a multiple extrude object. ```python vs.BeginMXtrd(0,1 + 363/512) vs.Rect(-125/128,1 + 113/512,375/512,375/512) vs.Rect(-25/32,1 + 113/512,275/512,375/512) vs.Rect(-75/128,1 + 113/512,325/1024,375/512) vs.Locus(-275/2048,125/128) vs.Rect(-75/128,1 + 113/512,325/1024,375/512) vs.Rect(-25/32,1 + 113/512,275/512,375/512) vs.Rect(-125/128,1 + 113/512,375/512,375/512) vs.EndMXtrd() ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/IFC_DMGetEntriesCnt.md Example of how to use IFC_DMGetEntriesCnt in Python to get the count of 'Space' entries. ```python cnt = 0 boo, cnt = vs.IFC_DMGetEntriesCnt('Space', cnt) if boo: vs.AlrtDialog(f"Count of Entries: {cnt}") ``` -------------------------------- ### Python Function Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/DBeam_BeginShttGet.md Starts the shutter get routine in Python. ```python def vs.DBeam_BeginShttGet(): return None ``` -------------------------------- ### VectorScript Binary Data Writing Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/examples/FileIO.md Illustrates writing binary data, specifically an array of integers, and how it translates to bytes. ```pascal arr : ARRAY [1..5] OF INTEGER; FUNCTION MixBytes(b1, b2: INTEGER) : INTEGER; BEGIN MixBytes := b1 + b2 * 256; END; BEGIN arr[1] := MixBytes( 1, 2 ); arr[2] := MixBytes( 255, 254 ); Write(arr); ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/IFC_DMGetEntriesCnt.md Example of how to use IFC_DMGetEntriesCnt in VectorScript to get the count of 'Space' entries. ```pascal PROCEDURE GetEntriesCnt; VAR cnt : INTEGER; BEGIN IF IFC_DMGetEntriesCnt('Space', cnt) THEN AlrtDialog(Concat('Count of Entries: ', cnt)); END; RUN(GetEntriesCnt); ``` -------------------------------- ### Example Usage (Python) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/CreateMarkerPopup.md Example demonstrating how to use CreateMarkerPopup in Python. ```python def Dialog_Handler( item , data ): pass def Example(): dialog1 = vs.CreateLayout('Untitled Dialog', False, 'OK', 'Cancel') vs.CreateMarkerPopup(dialog1, 4) vs.SetFirstLayoutItem(dialog1, 4) result = vs.RunLayoutDialog(dialog1, Dialog_Handler) Example() ``` -------------------------------- ### Example Usage (Python) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetPrefString.md Example of how to use GetPrefString in Python to get the unit mark. ```python unitmark = vs.GetPrefString(154) ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/CreateWallStyle.md Example of creating a wall style and inserting a component. ```Python def Example(): wallStyleName = 'Example Wall Style' wallStyleHandle = vs.CreateWallStyle(wallStyleName) wdth = 1 fill = 1 #{solid white} pwLeft = 14 #{in mils} pwRight = 14 #{in mils} psLeft = 2 #{solid black} psRight = 2 #{solid black} boo = vs.InsertNewComponent(wallStyleHandle, 1, wdth, fill, pwLeft, pwRight, psLeft, psRight) vs.SetName(wallStyleHandle, wallStyleName) #{Reset the wall style name.} Example() ``` -------------------------------- ### Example Usage (VectorScript) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetPrefString.md Example of how to use GetPrefString in VectorScript to get the unit mark. ```pascal unitmark:=GetPrefString(154); ``` -------------------------------- ### QTInitialize Pascal Function Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/QTInitialize.md Initializes QuickTime and returns the QuickTime version number. ```pascal FUNCTION QTInitialize : INTEGER; ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetObjectVariableString.md Example of using GetObjectVariableString in Python to get the name of a dimension standard. ```python dimstdName = vs.GetObjectVariableString(h,27) ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetObjectVariableString.md Example of using GetObjectVariableString in VectorScript to get the name of a dimension standard. ```pascal dimstdName:= GetObjectVariableString(h,27); ``` -------------------------------- ### VectorScript Image and Paint Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/examples/ImageAndPaint.md This example shows how to import an image file, create a paint from it, and then create a copy of the image from the paint using VectorScript. ```pascal PROCEDURE Example; VAR hImage : HANDLE; copyImage : HANDLE; paintHandle : HANDLE; importPt : POINT; BEGIN GetPt(importPt.x, importPt.y); hImage := ImportImageFile('D:\\Lenna.png', importPt.x, importPt.y ); paintHandle := CreatePaintFromImage(hImage); copyImage := CreateImageFromPaint(paintHandle, 'Copy Image'); END; RUN(Example); ``` -------------------------------- ### Python FileIO Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/examples/FileIO.md Demonstrates basic file operations like getting version, appending, writing, and closing a file in Python using the vs module. ```python def Example(): major, minor, maintenance, platform = vs.GetVersion() if platform == 1: fileName = 'Macintosh HD:Example.txt' else: fileName = 'D:\\Example.txt' vs.Append(fileName) vs.WriteLn('example text') vs.Close(fileName) Example() ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/BeginSym.md Example of creating a symbol named 'WindowNew' using Python. ```Python vs.BeginSym('WindowNew') vs.Rect(-5*12 -11,-1*12,-2*12,-5*12 -11) vs.Rect(-5*12 -8 - 3/4,-2*12 + 1/4,-2*12 -2 - 1/4,-2*12 -10) vs.Rect(-5*12 -8 - 3/4,-3*12 - 1 - 3/4,-2*12 -2 - 1/4,-5*12 - 9) vs.Rect(-4*12 -7,-2*12 -7 - 3/4,-3*12 - 3 - 1/2,-2*12 - 9 - 1/2) vs.MoveTo(-5*12 - 11,-3*12) vs.LineTo(-2*12,-3*12) vs.EndSym() ``` -------------------------------- ### Example Usage (Pascal) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetLayerLevelType.md Example of how to get the Layer Level Type of the active layer. ```pascal VAR layerLevelType:STRING; BEGIN layerLevelType := GetLayerLevelType(ActLayer); ``` -------------------------------- ### Pascal Example Usage Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetDashStyle.md Example of using GetDashStyle to get or create a dash style. ```pascal GetDashStyle(scalesWithThickness: BOOLEAN; numPairs: INTEGER; dash1, gap1, dash2, gap2, dash3, gap3, dash4, gap4, dash5, gap5: REAL): INTEGER; indx := GetDashStyle(TRUE, 1, 0.12, 0.03); { returns the dash style index of 'ISO-02 Dashed' or creates a style in the document with these values } ``` -------------------------------- ### Get Menu Information Source: https://github.com/vectorworks/developer-scripting/blob/main/Common/Partner Install/pages/Partner Product Install Package.md Retrieves localized name, shortkey combinations, and other details for a menu item within a given menu path. ```Python def vs.ws2GetMenuInfo(menuPath): return DYNARRAY[] of CHAR(Display Name), BOOLEAN(HasShortkey), CHAR(Shortkey), INTEGER(ShortkeyModifier) ``` -------------------------------- ### GetClass Example (Python) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetClass.md Example of using GetClass in Python to get the object class. ```Python ObjectClass = vs.GetClass(handleToObject) ``` -------------------------------- ### GetClass Example (VectorScript) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetClass.md Example of using GetClass in VectorScript to get the object class. ```Pascal ObjectClass:=GetClass(handleToObject); ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/DistDialog.md Example of using DistDialog in Python to get a distance value from the user. ```python vs.Message(vs.DistDialog('Enter a distance value:",'0')) ``` -------------------------------- ### Example (Python) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetObjBeginningMarker.md Example usage of GetObjBeginningMarker in Python. ```python def Example(): h = vs.FSActLayer() ok, style, angle, size, width, thickBasis, thickness, visibility = vs.GetObjBeginningMarker (h) vs.Message (style, ' / ', angle, ' / ', size, ' / ', width, ' / ', thickBasis, ' / ', thickness, ' / ', visibility) Example() ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/examples/CreateShedDormer.md This Python code, using the vs module, achieves the same result as the VectorScript example by creating a roof and adding a shed dormer. ```python def Test(): roofHandle = vs.CreateRoof(True,5*12+1/2,5*12+1/2,4,9.52627) vs.AppendRoofEdge(roofHandle,-77*12+10,-25*12+3.18078,45,2*12,10*12) vs.AppendRoofEdge(roofHandle,-41*12+2,-25*12+3.18078,45,2*12,10*12) vs.AppendRoofEdge(roofHandle,-41*12+2,21*12+4.81922,45,2*12,10*12) vs.AppendRoofEdge(roofHandle,-77*12+10,21*12+4.81922,45 ,2*12,10*12) shedID=vs.CreateShedDormer(roofHandle) vs.SetShedAttributes(roofHandle,shedID,True,6*12,10*12,2*12,8) vs.SetDormerAttributes(roofHandle,shedID,3,18*12+4,True,3*12,63,False, 3*12) vs.SetDormerThick(roofHandle, 2,1.83333) Test() ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/BeginFolder.md This example demonstrates how to create a symbol folder named 'Object Symbols' and add a symbol named 'Oval Symbols' within it using Python scripting, including setting pen and fill attributes and drawing an oval. ```Python vs.NameObject('Object Symbols') vs.BeginFolder() vs.BeginSym('Oval Symbols') vs.PenSize(14) vs.PenPat(2) vs.FillPat(1) vs.FillFore(0,0,0) vs.FillBack(65535,65535,65535) vs.PenFore(0,0,0) vs.PenBack(65535,65535,65535) vs.Oval(-1/4,1/4,3/4,-3/4) vs.EndSym() vs.EndFolder() ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/DistDialog.md Example of using DistDialog in VectorScript to get a distance value from the user. ```pascal Message(DistDialog('Enter a distance value:','0')); ``` -------------------------------- ### Example Usage (VectorScript) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/CreateMarkerPopup.md Example demonstrating how to use CreateMarkerPopup in VectorScript. ```pascal PROCEDURE Example; VAR dialog1 :INTEGER; result :INTEGER; PROCEDURE Dialog_Handler(VAR item :LONGINT; data :LONGINT); BEGIN END; BEGIN dialog1 := CreateLayout('Untitled Dialog', FALSE, 'OK', 'Cancel'); CreateMarkerPopup(dialog1, 4); SetFirstLayoutItem(dialog1, 4); result := RunLayoutDialog(dialog1, Dialog_Handler); END; RUN(Example); ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/BotBound.md Example of using BotBound in VectorScript to get the bounding box y-coordinate. ```pascal BotBValue:=BotBound(N='MyRect'); ``` -------------------------------- ### VectorScript CustomObject Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/examples/CustomObject.md This VectorScript example demonstrates how to get custom object information, set its color, and retrieve the color index. ```pascal PROCEDURE Example; VAR objName :STRING; objHand, recHand, wallHand :HANDLE; colorIndexBefore, colorIndexAfter, pRed, pGreen, pBlue :INTEGER; boo :BOOLEAN; BEGIN pRed := 65535; pGreen := 0; pBlue := 0; IF GetCustomObjectInfo(objName, objHand, recHand, wallHand) THEN BEGIN RGBToColorIndex(pRed, pGreen, pBlue, colorIndexBefore); Rect(0, 0, 1, 1); SetFillBack(LNewObj, colorIndexBefore); IF SetCustomObjectColor(objHand, 1, colorIndexBefore) THEN BEGIN boo := GetCustomObjectColor(objHand, 1, colorIndexAfter); AlrtDialog(Concat('before: ', colorIndexBefore, Chr(13), 'after: ', colorIndexAfter)); END; END; END; RUN(Example); ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/PenFore.md Demonstrates setting the pen foreground color using both RGB values and Color Index values. ```python vs.PenFore((65535, 0, 39321)) # using RGB values colorIndex = vs.RGBToColorIndex(65535, 0, 39321) vs.PenFore(colorIndex) # using Color Index values ``` -------------------------------- ### Example Usage of CreateTile Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/CreateTile.md Demonstrates how to use the CreateTile function in PascalScript. ```pascal tileHandle := CreateTile('My Tile'); ``` -------------------------------- ### Pascal Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/VolumeN.md Example of how to use VolumeN in Pascal to get the total volume of empty spaces. ```pascal totalVol:=VolumeN((C='Empty Space')); ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/SurfaceArea.md Example of how to use SurfaceArea in VectorScript to get the total area of empty space. ```pascal totalArea:=SurfaceArea((C='Empty Space')); ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/BeginRoof.md Example of using the BeginRoof function in Python. ```python vs.BeginRoof(1,1,5,1,2,2,0.5,1,1,0) vs.ClosePoly() vs.Poly(1,1,3,1,3.5,2,4,1,5,1,5,5,1,5) vs.EndGroup() ``` -------------------------------- ### Example (Python) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/CreateStaticHatchFromObject.md Example of how to create a static hatch using CreateStaticHatchFromObject. ```python def PickPointCallback(pt): h = vs.CreateStaticHatchFromObject(vs.FSActLayer(),'Default Hatch', pt[0], pt[1], 0) vs.GetPt( PickPointCallback ) ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/NumCustomObjectChoices.md Example of how to use NumCustomObjectChoices to get the maximum number of choices for a popup menu. ```pascal maxChoices := NumCustomObjectChoices(objName, 'PDINNER_MENU'); ``` -------------------------------- ### Pascal Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/LengthN.md Example of using LengthN in Pascal to get the length of all objects in the 'CrossMembers' class. ```pascal LengthValue:=LengthN(C='CrossMembers'); {returns the length of all objects in class 'CrossMembers'} ``` -------------------------------- ### Example (PascalScript) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/IFC_DefPsetBegin.md Example demonstrating the usage of IFC_DefPsetBegin, IFC_DefPsetAddMember, and IFC_DefPsetEnd. ```pascal PROCEDURE Test; VAR ok : BOOLEAN; psetName: STRING; BEGIN psetName:= 'My Custom Pset'; ok := IFC_DefPsetBegin( psetName ); ok := IFC_DefPsetAddMember( psetName, 'Field', 'IfcInteger' ); ok := IFC_DefPsetEnd( psetName ); END; RUN(Test); ``` -------------------------------- ### Pascal Procedure for DBeam_Begin Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/DBeam_Begin.md Starts the drawing beam routine in Pascal. ```pascal PROCEDURE DBeam_Begin; ``` -------------------------------- ### Example Usage Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetStoryOfLayer.md Example of how to use GetStoryOfLayer to get the current active layer's story. ```pascal VAR story:HANDLE; BEGIN story:=GetStoryOfLayer(ActLayer); ``` -------------------------------- ### Example (Python) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/IFC_DefPsetBegin.md Example demonstrating the usage of IFC_DefPsetBegin, IFC_DefPsetAddMember, and IFC_DefPsetEnd. ```python psetName = "My Custom Pset" ok = vs.IFC_DefPsetBegin( psetName ) ok = vs.IFC_DefPsetAddMember( psetName, "Field", "IfcInteger" ) ok = vs.IFC_DefPsetEnd( psetName ) ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetLayer.md Example of using GetLayer in Python to get the layer handle of an object. ```python LayerHandle = vs.GetLayer(ObjHd) ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetLayer.md Example of using GetLayer in VectorScript to get the layer handle of an object. ```pascal LayerHandle:=GetLayer(ObjHd); ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/WriteLn.md This example demonstrates how to use the WriteLn procedure to write formatted data to a text file. ```pascal PROCEDURE Example; CONST Vendor = 'ACME'; Price = 123.45; Tax = 1.07; BEGIN ReWrite('Output.txt'); WriteLn('Mfr/Cost: ', Vendor, '/', Price + Tax); Close('Output.txt'); END; RUN(Example); ``` -------------------------------- ### Respond to Font and Text Size Source: https://github.com/vectorworks/developer-scripting/blob/main/Common/Tasks/Parametrics/Plug-in with widget basic example.md Sets a plug-in object to respond to font and text size changes. ```Python vs.SetObjectVariableBoolean(gPio_H, 800, True) ``` -------------------------------- ### Example (Python) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetClFPat.md Example of how to use GetClFPat in Python to get the fill pattern of the 'Dimension' class. ```python def Example(): vs.Message(vs.GetClFPat('Dimension')) Example(); ``` -------------------------------- ### Python Example Usage Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/ApplyCustomTexPart.md Example of how to use ApplyCustomTexPart in Python. ```python ApplyCustomTexPart(parentPIO, pioSubObj, 100); ``` -------------------------------- ### Example (VectorScript) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetClFPat.md Example of how to use GetClFPat in VectorScript to get the fill pattern of the 'Dimension' class. ```pascal PROCEDURE Example; BEGIN Message(GetClFPat('Dimension')); END; RUN(Example); ``` -------------------------------- ### Create3Dobj Pascal Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/BeginXtrd.md Example function in Pascal to create a 3D object from an existing handle, preserving the original handle. ```pascal { ***************************************** } { Orso.B.Schmid, creates an extrude from a HANDLE h, preserving the original h. Returns a handle to the extrude } FUNCTION Create3Dobj(h: HANDLE; z, dZ: REAL): HANDLE; BEGIN IF h <> NIL THEN BEGIN BeginXtrd(z, dZ); LineTo(1, 1); { just draw something for creating an extrude container } EndXtrd; DelObject(FIn3D(GetParent(CreateDuplicateObject(h, LNewObj)))); { places a copy of h in the extrude and deletes the line } Create3Dobj := LNewObj; END; END; ``` -------------------------------- ### Example Usage Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/FFillPat.md Example usage of FFillPat in VectorScript and Python to get the current fill style. ```pascal currFillStyle:=FFillPat; ``` ```python currFillStyle = vs.FFillPat() ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/CriteriaSurfaceArea.md Example of using CriteriaSurfaceArea in VectorScript to get the total area of empty space. ```pascal totalArea:=CriteriaSurfaceArea((C='Empty Space')); ``` -------------------------------- ### Python Example Usage Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/AddCustomTexPart.md Example of how to use AddCustomTexPart in Python. ```python RemoveCustomTexParts(h); AddCustomTexPart(h, 100, ‘Stringers’); AddCustomTexPart(h, 200, ‘Treads’); ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetVersion.md Example of how to use the GetVersion function in Python. ```python def Example(): appMajor, appMinor, appMaint, platform = vs.GetVersion() osMajor, osMinor, osIncr = vs.GetOSVersion() if (platform == 1): platformStr = 'MacOS' else: platformStr = 'Windows' vs.Message('VectorWorks ', appMajor, '.', appMinor, '.', appMaint, ' running on ', platformStr, ' ', osMajor, '.', osMinor, '.', osIncr) Example() ``` -------------------------------- ### VectorScript SimpleDialog Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/examples/SimpleDialog.md This example shows how to use IntDialog to get an integer input from the user in VectorScript. ```pascal PROCEDURE Example; VAR i : INTEGER; BEGIN i := IntDialog('Enter an integer:', '0'); IF NOT DidCancel THEN BEGIN i := i*3; Message(i); END; END; RUN(Example); ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/FillFore.md Examples of using vs.FillFore with RGB values and Color Index values. ```Python vs.FillFore((65535, 0, 39321)) # using RGB values colorIndex = vs.RGBToColorIndex(65535, 0, 39321) vs.FillFore(colorIndex) # using Color Index values ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/YCenter.md Example of using YCenter in VectorScript to get the y-coordinate of the center of a named object. ```VectorScript YCenValue:=YCenter(N='Board'); {returns the y-coord of the center of the named object 'Board'} ``` -------------------------------- ### Example Usage (Pascal) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/CreateStaticHatch.md Example of how to use CreateStaticHatch in Pascal. ```pascal PROCEDURE Example; VAR h:HANDLE; x,y:REAL; BEGIN GetPt(x,y); h := CreateStaticHatch('Default Hatch', x, y, 0); DSelectAll; SetSelect(h); END; RUN(Example); ``` -------------------------------- ### SurfaceAreaN Pascal Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/SurfaceAreaN.md Example of how to use SurfaceAreaN in Pascal to get the total area of empty space. ```pascal totalArea:=SurfaceAreaN((C='Empty Space')); ``` -------------------------------- ### Example Usage Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/WriteBin.md Examples of how to use the WriteBin function in Python. ```python WriteBin('text', 0); { string, mac } WriteBin(1234); { number } ``` -------------------------------- ### Pascal Example Usage Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/RightBoundN.md An example of how to use the RightBoundN function in Pascal to get the right bound value. ```pascal RightBValue:=RightBoundN(N='MyRect'); ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetDefaultBeginningMarker.md Example of how to use GetDefaultBeginningMarker in VectorScript. ```pascal PROCEDURE Example; VAR ok : BOOLEAN; style: INTEGER; angle: INTEGER; size: REAL; width: REAL; thickBasis: INTEGER; thickness: REAL; visibility: BOOLEAN; BEGIN ok := GetDefaultBeginningMarker (style, angle, size, width, thickBasis, thickness, visibility); Message (style, ' / ', angle, ' / ', size, ' / ', width, ' / ', thickBasis, ' / ', thickness, ' / ', visibility); END; RUN(Example); ``` -------------------------------- ### Example Usage (Python) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/ObjectType.md Example of how to use the vs.ObjectType function in Python to get the type of an object by its name. ```python TypeValue = vs.ObjectType( "N='Mystery Object'" ); # returns the type of the object named 'Mystery Object' ``` -------------------------------- ### Example Usage (Pascal) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/ObjectType.md Example of how to use the ObjectType function in VectorScript to get the type of an object by its name. ```pascal TypeValue:=ObjectType(N='Mystery Object'); {returns the type of the object named 'Mystery Object'} ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetScreen.md Example of how to use GetScreen in VectorScript. ```pascal PROCEDURE Example; VAR x1, y1, x2, y2 :INTEGER; BEGIN GetScreen(x1, y1, x2, y2); Message(x1,' ',y1,' ',x2,' ',y2); END; RUN(Example); ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/MouseDown.md Example of using MouseDown in Python to get mouse click coordinates and display them. ```python down = False while not down: down, pt = vs.MouseDown() # pt is a tuple (x, y) vs.AlrtDialog(str(pt)) ``` -------------------------------- ### Example Usage (Pascal) Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetStoryAbove.md Example of how to use GetStoryAbove in Pascal. ```pascal VAR baseStory:HANDLE; storyAbove:HANDLE; BEGIN baseStory := GetStoryOfLayer(ActLayer); storyAbove := StoryAbove(baseStory); ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/Length.md Example of using the Length function in VectorScript to get the length of all objects in a specific class. ```pascal LengthValue:=Length(C='CrossMembers'); {returns the length of all objects in class 'CrossMembers'} ``` -------------------------------- ### Python Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetFldType.md Example of how to use GetFldType in Python to get the field type of the 3rd field in a record. ```python fieldType = vs.GetFldType(recordHandle,3) ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/CreateWallStyle.md Example of creating a wall style and inserting a component. ```Pascal PROCEDURE Example; CONST wallStyleName = 'Example Wall Style'; VAR wallStyleHandle :HANDLE; wdth :REAL; fill :LONGINT; pwLeft, pwRight, psLeft, psRight :INTEGER; boo :BOOLEAN; BEGIN wallStyleHandle := CreateWallStyle(wallStyleName); wdth := 1\"; fill := 1; {solid white} pwLeft := 14; {in mils} pwRight := 14; {in mils} psLeft := 2; {solid black} psRight := 2; {solid black} boo := InsertNewComponent(wallStyleHandle, 1, wdth, fill, pwLeft, pwRight, psLeft, psRight); SetName(wallStyleHandle, wallStyleName); {Reset the wall style name.} END; RUN(Example); ``` -------------------------------- ### BuildResourceList2 Usage Examples Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/BuildResourceList2.md Demonstrates various ways to call the BuildResourceList2 function with different parameters to retrieve resources from various locations and with different content options. ```pascal resID := 127; { wall styles } pathID := 113; { Wall ~ Slabs folder } list := BuildResourceList2(resID, 0, '', cnt, FALSE); { current document } list := BuildResourceList2(resID, 0, '', cnt, TRUE); { current document } list := BuildResourceList2(resID, pathID, '', cnt, FALSE); { current document } list := BuildResourceList2(resID, pathID, '', cnt, TRUE); { app folder if def content = true } list := BuildResourceList2(resID, -pathID, '', cnt, FALSE); { returns nothing! } list := BuildResourceList2(resID, -pathID, '', cnt, TRUE); { user folder if def content = true } ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/GetFldType.md Example of how to use GetFldType in VectorScript to get the field type of the 3rd field in a record. ```pascal fieldType:=GetFldType(recordHandle,3); ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/ColorIndexToRGB.md Example of using ColorIndexToRGB to get the color value components of the color at position 45. ```vectorscript ColorIndexToRGB(45, r, g, b); {returns the color value components of the color at position 45} ``` -------------------------------- ### VectorScript Example Source: https://github.com/vectorworks/developer-scripting/blob/main/Function Reference/Functions/BeginSym.md Example of creating a symbol named 'Window' using VectorScript. ```Pascal BeginSym('Window'); Rect(-5'-11",-1",-2'-0",-5'-11"); Rect(-5'-8 3/4",-2 1/4",-2'-2 1/4",-2'-10"); Rect(-5'-8 3/4",-3'-1 3/4",-2'-2 1/4",-5'-9"); Rect(-4'-7",-2'-7 3/4",-3'-3 1/2",-2'-9 1/2"); MoveTo(-5'-11",-3'-0"); LineTo(-2'-0",-3'-0"); EndSym; ```