### Example Command Line with Switches Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-7FDC500C-E04A-432D-A73D-EB1B6C6728B1 This example demonstrates starting AutoCAD with a specific drawing template, restoring a named view, and executing a script file. Command line switches override settings from the Options dialog and environment variables for the current session. ```bash "d:\AutoCAD 2026\acad.exe” /t "d:\AutoCAD 2026\templatearch1.dwt" /v "plan1" /b "startup" ``` -------------------------------- ### Example Command Line with Switches Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-CE4A928E-FDB1-470A-8176-32ABD1E3C6A1 This example demonstrates how to launch AutoCAD with a template file, a viewport, and a startup script. The executable path and template path are enclosed in quotes. ```bash "d:\AutoCAD 2026\acad.exe" /t "d:\AutoCAD 2026\templatearch1.dwt" /v "plan1" /b "startup" ``` -------------------------------- ### Get Start Point of an Ellipse Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-AA1C450F-AA6E-4B05-AFB3-989AD91ADBFC Retrieves the start point of an ellipse object. For ellipses, the start and end points are identical. ```AutoLISP (vlax-curve-getStartPoint ellipseObj) (2.0 2.0 0.0) ``` -------------------------------- ### Get Start Point of a Spline Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-AA1C450F-AA6E-4B05-AFB3-989AD91ADBFC Obtains the start point of a spline object. This is useful for curve analysis and manipulation. ```AutoLISP (vlax-curve-getStartPoint splineObj) (1.73962 2.12561 0.0) ``` -------------------------------- ### Example of Promoted Properties (context = 1) Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-A65FBCCF-CC5D-47E8-9117-D577D9CB9D8A&p=OARX Demonstrates how properties like StartPoint are displayed when the context is set to 1, breaking them down into X, Y, and Z components. ```autolisp StartPoint/X (type: double) (LocalName: Start X) = 6.250000 StartPoint/Y (type: double) (LocalName: Start Y) = 8.750000 StartPoint/Z (type: double) (LocalName: Start Z) = 0.000000 ``` -------------------------------- ### Get Lower Bound of Second Dimension Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-8ABBA8A8-D421-48D2-BCBC-34DA1C728A78 Retrieves the starting index of the second dimension of the safearray. This dimension starts at index 0. ```autolisp (vlax-safearray-get-l-bound tmatrix 2) ``` -------------------------------- ### Initialize Keywords and Get User Input Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-9F940144-0D7B-4DA1-BF50-BBF8FB8DFF21 Sets up valid keywords 'Yes' and 'No' using initget, disallowing null input. Then, it prompts the user and captures their response using getkword. ```autolisp (initget 1 "Yes No") nil (setq x (getkword "\nAre you sure? [Yes/No]: ")) Are you sure? [Yes/No]: **yes** "Yes" ``` -------------------------------- ### Get Curve Start Parameter (AutoLISP) Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-37282EB1-D47C-4039-B1AF-744EB5B53F25 Obtain the starting parameter of a curve object. This is often used as a reference point for other curve measurements. ```autolisp (setq startSpline (vlax-curve-getStartParam splineObj)) ``` -------------------------------- ### (startapp _appcmd file_) Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-E2B683FE-43FB-4F5D-A9AE-809772FE8D3B&p=OARX Starts a Windows application. ```APIDOC ## (startapp _appcmd file_) ### Description Starts a Windows application. ### Platforms - Windows: AutoCAD, AutoCAD LT - Mac OS: AutoCAD ``` -------------------------------- ### launch.json Configuration (Windows) Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-A7CC8D30-D74E-418A-9F03-51878E512163 Example launch.json file for Windows, including configurations for AutoLISP Debug: Launch and AutoLISP Debug: Attach. ```json { "configurations": [ { "type": "launchlisp", "request": "launch", "name": "Autolisp Debug: Launch", "attributes": { "path": **"C:\\Program Files\\Autodesk\\AutoCAD 2026\\acad.exe"**, "params": "" } }, { "type": "attachlisp", "request": "attach", "name": "Autolisp Debug: Attach", "attributes": { "process": **"acad"** } } ] } ``` -------------------------------- ### Get Lower Bound of First Dimension Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-8ABBA8A8-D421-48D2-BCBC-34DA1C728A78 Retrieves the starting index of the first dimension of the safearray. The first dimension typically starts at index 1. ```autolisp (vlax-safearray-get-l-bound tmatrix 1) ``` -------------------------------- ### Example of dumpallproperties with context=1 Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-A65FBCCF-CC5D-47E8-9117-D577D9CB9D8A This example demonstrates how to list properties for a line object, promoting values like StartPoint and EndPoint to individual X, Y, Z components by setting the context to 1. The output is displayed on the command line. ```autolisp (setq e1 (car (entsel "\nSelect a line: "))) (dumpAllProperties e1 1) ``` -------------------------------- ### Get Point and Apply Osnap Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-33498AA8-EDC0-45A3-9603-47A3F3510924 This example demonstrates how to get a point from the user and then use the osnap function to find the endpoint or intersection point near the user-specified point. ```autolisp (setq pt1 (getpoint)) (11.8637 3.28269 0.0) ``` ```autolisp (setq pt2 (osnap pt1 "_end,_int")) (12.1424 3.42181 0.0) ``` -------------------------------- ### Single Viewport Configuration Example (AutoLISP) Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-929FC8B2-1235-4B2A-B330-FF2E219E072C When TILEMODE is on, this example shows the expected output for a single-viewport configuration. ```autolisp ((1 (0.0 0.0) (1.0 1.0))) ``` -------------------------------- ### Get File Size on Mac OS and Web (AutoLISP) Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-646032BF-CAC1-4166-9EBA-2C954DFF3005&p=OARX This example shows how to get the file size for Mac OS and Web platforms. It returns 0 for the root directory. ```AutoLISP (vl-file-size "/output.txt") ``` ```AutoLISP 568 ``` ```AutoLISP (vl-file-size "/") ``` ```AutoLISP 0 ``` -------------------------------- ### Get AutoCAD Application Object (AutoLISP) Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-53DB599B-641D-45DD-A201-604942A4596C Use this function to get the top-level AutoCAD application object. This is the starting point for most ActiveX automation tasks in AutoCAD. Supported on Windows only. ```AutoLISP (setq aa (vlax-get-acad-object)) ``` -------------------------------- ### Create Registry Entries Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-3C25E517-8660-4BB7-9447-2310462EF06F This example demonstrates how to create a registry key 'MYREGKEY' and add two values: a string 'Example' and a DWORD integer '123'. Ensure the correct Type is specified for each value. ```xml ``` -------------------------------- ### Get or Create Excel Application Object Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-7AFF597F-D630-4489-8349-94EF67CCE1F0 Use this function to get a running instance of Excel or create a new one. Ensure Excel is installed and its programmatic identifier is correctly specified. ```autolisp (vlax-get-or-create-object "Excel.Application") ``` -------------------------------- ### Get First Entity Name with entnext (AutoLISP) Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-65924CF5-0C51-4E36-8B38-7A5513951A04 Call entnext without arguments to get the name of the first non-deleted entity in the drawing database. This is useful for starting an iteration through drawing entities. ```autolisp (setq e1 (entnext)) ; _Sets_ e1 _to the name of the first entity in the drawing_ ``` -------------------------------- ### Example Synonym Entry Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-74478DCE-92D4-49B1-93E9-DCF09D57FA0D This example demonstrates how entering SYMBOL will trigger the BLOCK command. ```plaintext SYMBOL, *BLOCK ``` -------------------------------- ### Start Notepad and open acad.lsp (Windows) Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-30EC493A-674B-4AAE-8C88-358E38CDAB21 Use this snippet to launch Notepad and open a specific file on Windows. Ensure the application name and file path are correctly specified. ```autolisp (startapp "notepad" "acad.lsp") ``` -------------------------------- ### Get Start Parameter of a Curve Object Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-854C3C4D-1305-4920-9E42-D9ACB9E4363C Use this function to retrieve the starting parameter of a curve object. Ensure the input is a valid VLA-object representing a curve. Returns nil if the operation fails. ```autolisp (vlax-curve-getstartparam ellipseObj) ``` -------------------------------- ### Get Localized Command Name (AutoLISP) Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-1DCDFFA6-0372-479D-B00F-D165EC5B8A2C In a French version of AutoCAD, this example shows how to get the underscored English name for the localized command 'ETIRER'. The input must be a string and 64 characters or less. ```autolisp (getcname "ETIRER") "_STRETCH" ``` -------------------------------- ### Property Promotion Example (AutoLISP) Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-A65FBCCF-CC5D-47E8-9117-D577D9CB9D8A Illustrates how the 'context' argument in dumpallproperties affects the output format of properties like StartPoint. When context is 0, it's a single value; when 1, it's promoted to X, Y, Z components. ```autolisp StartPoint (type: AcGePoint3d) (LocalName: StartPoint) = 6.250000 8.750000 0.000000 ``` ```autolisp StartPoint/X (type: double) (LocalName: Start X) = 6.250000 StartPoint/Y (type: double) (LocalName: Start Y) = 8.750000 StartPoint/Z (type: double) (LocalName: Start Z) = 0.000000 ``` -------------------------------- ### User Comment Example Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-EFC1FCF5-3CCF-4CDD-A205-1C2B3C747125 Demonstrates how to add comments to the unit definition file by starting a line with a semicolon. ```AutoLISP ; This entire line is a comment. ``` -------------------------------- ### Four Viewport Configuration Example (AutoLISP) Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-929FC8B2-1235-4B2A-B330-FF2E219E072C When TILEMODE is on, this example demonstrates the output for a four-viewport configuration, with viewport 5 as the current one. ```autolisp ((5 (0.5 0.0) (1.0 0.5)) (2 (0.5 0.5) (1.0 1.0)) (3 (0.0 0.5) (0.5 1.0)) (4 (0.0 0.0) (0.5 0.5))) ``` -------------------------------- ### WEBLOAD Command Usage Example Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-CFDF041A-ABED-47D7-AC86-50F0419E5474 Demonstrates how to use the WEBLOAD command to load a JavaScript file from a URL. Prompts the user for the URL. ```text Command: WEBLOAD Enter name of URL to load: _https://website/filename.js_ ``` -------------------------------- ### Using TimeDiff Function Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-EF8856E5-DB58-4EFC-B223-AB8B8A25F240 Examples demonstrating how to use the TimeDiff function to get the elapsed time in milliseconds and seconds. ```autolisp (setq T1 24092498) (setq T2 24188267) (TimeDiff T1 T2 T) 95769 ``` ```autolisp (TimeDiff T1 T2 nil) 95.769 ``` -------------------------------- ### Get Underscored English Command Name (AutoLISP) Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-1DCDFFA6-0372-479D-B00F-D165EC5B8A2C In a French version of AutoCAD, this example shows how to get the localized command name 'ETIRER' from the underscored English command '_STRETCH'. The input must be a string and 64 characters or less. ```autolisp (getcname "_STRETCH") "ETIRER" ``` -------------------------------- ### Example of Non-Promoted Properties (context = 0) Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-A65FBCCF-CC5D-47E8-9117-D577D9CB9D8A&p=OARX Illustrates how properties like StartPoint are displayed by default when the context is 0, as a single combined value. ```autolisp StartPoint (type: AcGePoint3d) (LocalName: StartPoint) = 6.250000 8.750000 0.000000 ``` -------------------------------- ### launch.json Configuration (Mac OS) Source: https://help.autodesk.com/view/ACD/2026/ENU?guid=GUID-A7CC8D30-D74E-418A-9F03-51878E512163 Example launch.json file for Mac OS, including configurations for AutoLISP Debug: Launch and AutoLISP Debug: Attach. ```json { "configurations": [ { "type": "launchlisp", "request": "launch", "name": "Autolisp Debug: Launch", "attributes": { "path": **"/Applications/Autodesk/AutoCAD 2026/AutoCAD 2026.app/Contents/MacOS/AutoCAD"**, "params": "" } }, { "type": "attachlisp", "request": "attach", "name": "Autolisp Debug: Attach", "attributes": { "process": **"AutoCAD"** } } ] } ```