### Example AutoCAD Startup with Switches Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-CE4A928E-FDB1-470A-8176-32ABD1E3C6A1 An example demonstrating how to start AutoCAD with a specific template file and a startup script. This is useful for automating the initial setup of a drawing. ```bash "d:\AutoCAD 2025\acad.exe" /t "d:\AutoCAD 2025\templatearch1.dwt" /v "plan1" /b "startup" ``` -------------------------------- ### Get a point and apply Object Snaps Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-33498AA8-EDC0-45A3-9603-47A3F3510924 This example demonstrates how to get a point from the user using getpoint and then apply object snaps like _end and _int to that point using the osnap function. ```autolisp (setq pt1 (getpoint)) (11.8637 3.28269 0.0) ``` ```autolisp (setq pt2 (osnap pt1 "_end,_int")) (12.1424 3.42181 0.0) ``` -------------------------------- ### Start Notepad with a File Containing Spaces on Windows Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-30EC493A-674B-4AAE-8C88-358E38CDAB21 This example shows how to use startapp on Windows when the file path contains spaces. Literal double quotes are used to enclose the file name argument, ensuring it is parsed correctly by Notepad. ```autolisp (startapp "notepad.exe" "\"my stuff.txt\"") 33 ``` -------------------------------- ### Get and Set Operating System Environment Variable Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-529819FD-9E9C-4789-BA18-B981BA32DD23 This example shows how to get the current value of the MaxHatch environment variable, set it to a new string value, and then restore the original value. It utilizes getenv, prompt, and setenv functions. ```autolisp (setq curMaxHatch (getenv "MaxHatch")) (prompt (strcat "\nCurrent value of MaxHatch: " curMaxHatch)) (setenv "MaxHatch" "50000") (prompt (strcat "\nNew value of MaxHatch: " (getenv "MaxHatch"))) (setenv "MaxHatch" curMaxHatch) ``` -------------------------------- ### Assign Variables for Examples Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-7E85CB8F-B4DA-42F3-ABD3-89342A11EF9B These assignments set up variables used in the subsequent 'equal' function examples. ```autolisp (setq f1 '(a b c)) (setq f2 '(a b c)) (setq f3 f2) (setq a 1.123456) (setq b 1.123457) ``` -------------------------------- ### Get Lower Bound of Second Dimension Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-8ABBA8A8-D421-48D2-BCBC-34DA1C728A78 Retrieves the starting index of the second dimension of a safearray. This example shows how the second dimension might start with index 0. ```autolisp (vlax-safearray-get-l-bound tmatrix 2) ``` -------------------------------- ### Combine two functions using defun-q-list-set Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-CDA30337-9889-4D33-9461-503F307D1360 This example illustrates how to combine the functionality of two existing functions, 's::startup' and 'my-startup', into a single function using defun-q-list-set and defun-q-list-ref. ```autolisp (defun-q s::startup (x) (print x)) ``` ```autolisp (defun-q my-startup (x) (print (list x))) ``` ```autolisp (defun-q-list-set 's::startup (append (defun-q-list-ref 's::startup) (cdr (defun-q-list-ref 'my-startup)))) ``` -------------------------------- ### Get Start Parameter of an Ellipse Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-854C3C4D-1305-4920-9E42-D9ACB9E4363C Use this function to determine the starting parameter of a curve object, such as an ellipse. This example assumes ellipseObj is a valid VLA-object representing an ellipse. ```autolisp (vlax-curve-getstartparam ellipseObj) ``` -------------------------------- ### Provide Startup Information in AutoLISP Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-92FFBC4B-F420-4BDC-8D49-7FE8DBB03D54 This snippet is from the main program file (_gpmain.lsp_) and provides a message to the user indicating the command to start the application. It should be loaded last in the project. ```autolisp (princ "\nType GPATH to draw a garden path.") (princ) ``` -------------------------------- ### Example of dumpallproperties with context=1 Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-A65FBCCF-CC5D-47E8-9117-D577D9CB9D8A Demonstrates how to list available properties for a line object with properties promoted to individual values. This example requires selecting a line entity first. ```autolisp (setq e1 (car (entsel "\nSelect a line: "))) Select a line: (dumpAllProperties e1 1) ``` ```text Begin dumping object (class: AcDbLine) Angle (type: double) (RO) (LocalName: Angle) = 5.159347 Annotative (type: bool) (LocalName: Annotative) = Failed to get value to get value Area (type: double) (RO) (LocalName: Area) = 0.000000 BlockId (type: AcDbObjectId) (RO) = Ix CastShadows (type: bool) = 0 ClassName (type: AcString) (RO) = Closed (type: bool) (RO) (LocalName: Closed) = Failed to get value CollisionType (type: AcDb::CollisionType) (RO) = 1 Color (type: AcCmColor) (LocalName: Color) = BYLAYER Delta/X (type: double) (RO) (LocalName: Delta X) = 3.028287 Delta/Y (type: double) (RO) (LocalName: Delta Y) = -6.318026 Delta/Z (type: double) (RO) (LocalName: Delta Z) = 0.000000 EndParam (type: double) (RO) = 7.006281 EndPoint/X (type: double) (LocalName: End X) = 23.249243 EndPoint/Y (type: double) (LocalName: End Y) = 11.968958 EndPoint/Z (type: double) (LocalName: End Z) = 0.000000 ExtensionDictionary (type: AcDbObjectId) (RO) = Ix Handle (type: AcDbHandle) (RO) = 1b2 HasFields (type: bool) (RO) = 0 HasSaveVersionOverride (type: bool) = 0 Hyperlinks (type: AcDbHyperlink*) IsA (type: AcRxClass*) (RO) = AcDbLine IsAProxy (type: bool) (RO) = 0 IsCancelling (type: bool) (RO) = 0 IsEraseStatusToggled (type: bool) (RO) = 0 IsErased (type: bool) (RO) = 0 IsModified (type: bool) (RO) = 0 IsModifiedGraphics (type: bool) (RO) = 0 IsModifiedXData (type: bool) (RO) = 0 IsNewObject (type: bool) (RO) = 0 IsNotifyEnabled (type: bool) (RO) = 0 IsNotifying (type: bool) (RO) = 0 IsObjectIdsInFlux (type: bool) (RO) = 0 IsPeriodic (type: bool) (RO) = 0 IsPersistent (type: bool) (RO) = 1 IsPlanar (type: bool) (RO) = 1 IsReadEnabled (type: bool) (RO) = 1 IsReallyClosing (type: bool) (RO) = 1 IsTransactionResident (type: bool) (RO) = 0 IsUndoing (type: bool) (RO) = 0 IsWriteEnabled (type: bool) (RO) = 0 LayerId (type: AcDbObjectId) (LocalName: Layer) = Ix Length (type: double) (RO) (LocalName: Length) = 7.006281 LineWeight (type: AcDb::LineWeight) (LocalName: Lineweight) = -1 LinetypeId (type: AcDbObjectId) (LocalName: Linetype) = Ix LinetypeScale (type: double) (LocalName: Linetype scale) = 1.000000 LocalizedName (type: AcString) (RO) = Line MaterialId (type: AcDbObjectId) (LocalName: Material) = Ix MergeStyle (type: AcDb::DuplicateRecordCloning) (RO) = 1 Normal/X (type: double) = 0.000000 Normal/Y (type: double) = 0.000000 Normal/Z (type: double) = 1.000000 ObjectId (type: AcDbObjectId) (RO) = Ix OwnerId (type: AcDbObjectId) (RO) = Ix PlotStyleName (type: AcString) (LocalName: Plot style) = ByLayer ReceiveShadows (type: bool) = 0 Failed to get value StartParam (type: double) (RO) = 0.000000 StartPoint/X (type: double) (LocalName: Start X) = 20.220956 StartPoint/Y (type: double) (LocalName: Start Y) = 18.286984 StartPoint/Z (type: double) (LocalName: Start Z) = 0.000000 Thickness (type: double) (LocalName: Thickness) = 0.000000 Transparency (type: AcCmTransparency) (LocalName: Transparency) = 0 Visible (type: AcDb::Visibility) = 0 End object dump ``` -------------------------------- ### Get Start Point of an Ellipse Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-AA1C450F-AA6E-4B05-AFB3-989AD91ADBFC Retrieves the starting point of an ellipse object. For ellipses, the start and end points are identical. ```AutoLISP (vlax-curve-getStartPoint ellipseObj) ``` -------------------------------- ### Get Start Parameter of a Spline Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-E1C78CD1-2347-4A2B-B054-62149738F9A6 Obtains the starting parameter of a spline object. This is a prerequisite for other curve measurement functions. ```autolisp (setq startSpline (vlax-curve-getStartParam splineObj)) ``` -------------------------------- ### Display Help Information Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-4CB4A951-1507-4F3D-9F7B-93FF3A2C9850 This example demonstrates how to call the help function to display information about 'MYCOMMAND' from the 'achelp.chm' help file. Ensure the help file is accessible. ```autolisp (help "achelp.chm" "mycommand") ``` -------------------------------- ### Start Notepad and Open acad.lsp on Windows Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-30EC493A-674B-4AAE-8C88-358E38CDAB21 This snippet demonstrates how to start the Notepad application and open the 'acad.lsp' file using the startapp function on Windows. Ensure Notepad is in your system's PATH or provide the full path. ```autolisp (startapp "notepad" "acad.lsp") 33 ``` -------------------------------- ### Get Start Point of a Spline Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-AA1C450F-AA6E-4B05-AFB3-989AD91ADBFC Retrieves the starting point of a spline object. This is useful for curve analysis and manipulation. ```AutoLISP (vlax-curve-getStartPoint splineObj) ``` -------------------------------- ### Single Viewport Configuration Example (AutoLISP) Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-929FC8B2-1235-4B2A-B330-FF2E219E072C Illustrates the output of the vports function for a single-viewport configuration with TILEMODE on. ```autolisp ((1 (0.0 0.0) (1.0 1.0))) ``` -------------------------------- ### Get Start Parameter of a Curve Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-37282EB1-D47C-4039-B1AF-744EB5B53F25 Obtains the starting parameter of a curve object. This is useful for setting reference points on a curve. ```autolisp (setq startSpline (vlax-curve-getStartParam splineObj)) 0.0 ``` -------------------------------- ### Example of property promotion with context=0 and context=1 Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-A65FBCCF-CC5D-47E8-9117-D577D9CB9D8A Illustrates how the 'context' parameter in dumpallproperties affects the output of properties like Position, Normal, and StartPoint. Context 0 shows a single value, while context 1 promotes them to individual X, Y, and Z values. ```text StartPoint (type: AcGePoint3d) (LocalName: StartPoint) = 6.250000 8.750000 0.000000 ``` ```text 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 ``` -------------------------------- ### vl-member-if-not Example Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-27EA5788-B68D-4302-900F-9D99902025E4 This example demonstrates how vl-member-if-not works by checking a list for elements that are not atoms. It returns the sublist starting from the first non-atom element. ```autolisp ; (vl-member-if-not 'atom '(1 "Str" (0 . "line") nil t)) ; ((0 . "line") nil t) ``` -------------------------------- ### Get Lower Bound of First Dimension Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-8ABBA8A8-D421-48D2-BCBC-34DA1C728A78 Retrieves the starting index of the first dimension of a safearray. The first dimension is typically indexed starting from 1. ```autolisp (vlax-safearray-get-l-bound tmatrix 1) ``` -------------------------------- ### Define a function using defun-q Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-DAF4A76E-9346-4A68-A0C8-17695177033B This snippet shows how to define a simple function named `my-startup` using the `defun-q` macro in AutoLISP. The function takes one argument `x` and prints a list containing `x`. ```autolisp (defun-q my-startup (x) (print (list x))) ``` -------------------------------- ### Get Distance to Midpoint of a Curve Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-8FF6D3D5-7EA5-4E9A-8A61-295C0562E7AE Calculate the distance from the start of the curve to its midpoint by determining the parameter midway along the curve. This requires knowing the start and end parameters. ```autolisp (vlax-curve-getDistAtParam splineObj ( / (- endspline startspline) 2)) 8.99417 ``` -------------------------------- ### Initialize Keywords and Get User Input Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-9F940144-0D7B-4DA1-BF50-BBF8FB8DFF21 This snippet demonstrates how to set up valid keywords ('Yes', 'No') and disallow null input using initget before calling getkword to prompt the user. The user's response is stored in the variable 'x'. ```autolisp (initget 1 "Yes No") nil (setq x (getkword "Are you sure? (Yes or No) ")) Are you sure? (Yes or No) **yes** "Yes" ``` -------------------------------- ### vl-string-mismatch Example 5 Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-D1EA6F47-146E-44BC-BBCA-40B7A874C0B8 Compares two strings, starting the search from specified positions. ```autolisp (vl-string-mismatch "vl-fun" "avl-var" 0 1) 3 ``` -------------------------------- ### Get Text Bounding Box Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-D6C31C79-ECBF-4C7D-9285-1CFA95AC0918 This example demonstrates how to use the textbox function to get the bounding box coordinates for a simple text string. It accepts current defaults for other text parameters. ```autolisp (textbox '((1 . "Hello world."))) ``` -------------------------------- ### start_image Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-FAD2CDD5-50CD-4328-B391-C898AAD4E401 Starts the creation of an image in the dialog box tile. ```APIDOC ## start_image ### Description Starts the creation of an image in the dialog box tile. ### Function Signature (start_image tile_name) ### Parameters * **tile_name** (string) - The name of the dialog box tile where the image will be created. ``` -------------------------------- ### vl-string-mismatch Example 7 Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-D1EA6F47-146E-44BC-BBCA-40B7A874C0B8 Compares two strings, specifying start positions and ignoring case. ```autolisp (vl-string-mismatch "VL-FUN" "Vl-vAR" 0 0 T) 3 ``` -------------------------------- ### startapp Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-FAD2CDD5-50CD-4328-B391-C898AAD4E401 Starts an external application. ```APIDOC ## startapp ### Description Starts an external application. ### Function Signature (startapp application [command_line]) ### Parameters * **application** (string) - The name of the application to start. * **command_line** (string, optional) - The command line arguments to pass to the application. ``` -------------------------------- ### Get Base Point and Orientation Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-4F8606DD-6453-4D01-84C6-EC8EEBBE2D1A This example first gets a base point from the user using getpoint, then uses that base point with getorient to prompt for an orientation angle. The returned angle is in radians. ```autolisp (setq pt1 (getpoint "Pick point: ")) (getorient pt1 "Pick point: ") ``` -------------------------------- ### Example of Localized Keywords with getkword Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-9ED8841B-5C1D-4B3F-9F3B-84A4408A6BBF This snippet demonstrates how to use initget with localized keywords for the getkword function. It shows how to define both localized and language-independent keywords and how user input maps to them. ```autolisp (initget "Abc Def _Ghi Jkl") (getkword "\nEnter an option (Abc/Def): ") ``` -------------------------------- ### start_dialog Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-FAD2CDD5-50CD-4328-B391-C898AAD4E401 Displays a dialog box and begins accepting user input. ```APIDOC ## start_dialog ### Description Displays a dialog box and begins accepting user input. ### Function Signature (start_dialog dialog_name) ### Parameters * **dialog_name** (string) - The name of the dialog box to display. ``` -------------------------------- ### Four Viewport Configuration Example (AutoLISP) Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-929FC8B2-1235-4B2A-B330-FF2E219E072C Shows the potential output of the vports function for a four-equal-sized viewport configuration with TILEMODE on. The first descriptor in the list always represents the current viewport. ```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))) ``` -------------------------------- ### vl-string-mismatch Example 8 Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-D1EA6F47-146E-44BC-BBCA-40B7A874C0B8 Compares two strings with special characters, specifying start positions and ignoring case. ```autolisp (vl-string-mismatch "abc€" "ABC€" 0 0 T) 4 ``` -------------------------------- ### Extract Substring from Position 2 Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-36F8701B-7AB7-47BE-AC31-8508A2DF46A2 This example demonstrates extracting a substring starting from the second character to the end of the string. ```autolisp (substr "abcde" 2) ``` -------------------------------- ### List specific files in a directory (Web) Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-C28C0CB0-FBBE-4AA8-BAC4-2FF222772514 This example demonstrates how to list files matching a specific pattern (*.lin) in a given directory on the Web. ```autolisp (vl-directory-files "/acad/Support" "*.lin") ("acad.lin") ``` -------------------------------- ### Get File Modification Time on Windows Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-7F6A31B2-7D51-4C4D-B239-206F398D67CA Example of using vl-file-systime to get the modification time of a file on Windows. The returned list includes year, month, day of week, day of month, hours, minutes, and seconds. ```autolisp (vl-file-systime "c:/program files//sample/visuallisp/yinyang.lsp") (1998 4 3 8 10 6 52) ``` -------------------------------- ### Start TextEdit with a File Containing Spaces on Mac OS Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-30EC493A-674B-4AAE-8C88-358E38CDAB21 This example demonstrates starting TextEdit on Mac OS with a file name that includes spaces. The file argument is enclosed in literal double quotes to handle spaces correctly. ```autolisp (startapp "textedit.app" "\"my stuff.txt\"") 33 ``` -------------------------------- ### Create Selection Set by Window Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-0F37CC5E-1559-4011-B8CF-A3BA0973B2C3 Use ssget with '_W' and two points to define a window. It selects objects completely inside this window. The result is a selection set. ```autolisp (ssget "_W" '(0 0) '(5 5)) ``` -------------------------------- ### Create and transform a line Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-7B1BBCDD-69DD-40E6-81CB-370A05725431 This example demonstrates creating a line and then rotating it 90 degrees using a transformation matrix. Ensure ActiveX support is loaded with (vl-load-com). ```AutoLISP (defun Example_TransformBy ( / acadObject acadDocument mSpace lineObj startPt endPt matList transMat) (vl-load-com) ; Load ActiveX support (setq acadObject (vlax-get-acad-object)) (setq acadDocument (vla-get-ActiveDocument acadObject)) (setq mSpace (vla-get-ModelSpace acadDocument)) ;;; Create a line (setq startPt (getpoint "\nPick the start point: ")) (setq endPt (vlax-3d-point (getpoint startPt "\nPick the end point: "))) (setq lineObj (vla-addline mSpace (vlax-3d-point startPt) endPt)) ;;; Initialize the transMat variable with a transformation matrix ;;; that will rotate an object by 90 degrees about the point(0,0,0). ;;; Begin by Creating a list of four lists, each containing four ;;; numbers, representing transformation matrix elements. (setq matList (list '(0 -1 0 0) '(1 0 0 0) '(0 0 1 0) '(0 0 0 1))) ;;; Use vlax-tmatrix to convert the list to a variant. (setq transmat (vlax-tmatrix matlist)) ;;; Transform the line using the defined transformation matrix (vla-transformby lineObj transMat) (vla-zoomall acadObject) (prompt "\nThe line has been transformed.") (princ) ) ``` -------------------------------- ### Load Bonusapp.lsp on Command Entry Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-421B36DE-38EA-4161-9768-01647B5492E8 This example demonstrates how to use the autoload function to load the 'bonusapp.lsp' file when the commands 'APP1', 'APP2', or 'APP3' are entered at the AutoCAD Command prompt. AutoCAD will search for 'bonusapp.lsp' in its support file search path. ```autolisp (autoload "BONUSAPP" '("APP1" "APP2" "APP3")) ``` -------------------------------- ### Extract Substring with Specific Length Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-36F8701B-7AB7-47BE-AC31-8508A2DF46A2 This example extracts a substring of a specified length (2 characters) starting from the third character. ```autolisp (substr "abcde" 3 2) ``` -------------------------------- ### Get Current Milliseconds Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-EF8856E5-DB58-4EFC-B223-AB8B8A25F240 Captures the current value of the MILLISECS system variable to mark a starting point for time measurement. ```autolisp Command: (setq start (getvar "MILLISECS")) 25494432 Command: (setq end (getvar "MILLISECS")) 25499471 ``` -------------------------------- ### List specific files in a directory (Windows) Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-C28C0CB0-FBBE-4AA8-BAC4-2FF222772514 This example demonstrates how to list files matching a specific pattern (acad*.exe) in a given directory on Windows. ```autolisp (vl-directory-files "c:/acadwin" "acad*.exe") ("ACAD.EXE" "ACADAPP.EXE" "ACADL.EXE" "ACADPS.EXE") ``` -------------------------------- ### Get First Entity Name Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-C7D27797-247E-49B9-937C-0D8C58F4C832 Retrieves the name of the first entity in the drawing. This is often the starting point for entity manipulation. ```autolisp (setq en1 (entnext)) ``` -------------------------------- ### Process Viewports in a Configuration Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-7B91F774-B0CD-4F5B-9FFA-1130443E659B This example demonstrates how to process all viewports within a specific configuration, such as '4VIEW'. It uses tblsearch with the _setnext_ argument set to T to coordinate with subsequent tblnext calls, ensuring all viewports in the configuration are handled. ```autolisp (setq v (tblsearch "VPORT" "4VIEW" T)) ; Finds first VPORT entry. (while (and v (= (cdr (assoc 2 v)) "4VIEW")) .. ; ... Processes entry ... . (setq v (tblnext "VPORT")) ; Gets next VPORT entry. ) ``` -------------------------------- ### Get Active Document Object Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-A2813E1F-8C79-4341-BF07-F44B8305D7E5 Retrieves the active AutoCAD document object. This is the starting point for interacting with the current drawing. ```autolisp (setq acadDocument (vla-get-ActiveDocument (vlax-get-acad-object))) ``` -------------------------------- ### startapp Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-30EC493A-674B-4AAE-8C88-358E38CDAB21 Starts an external application. If a file is provided, it will be opened by the application. The function searches the PATH environment variable for the application if a full path is not specified. ```APIDOC ## startapp ### Description Starts an external application and optionally opens a specified file. Searches the PATH environment variable if the application path is not absolute. ### Signature ``` (startapp _appcmd [file]_) ``` ### Parameters #### Path Parameters - **_appcmd** (String) - Required - Application to execute. If _appcmd_ does not include a full path name, startapp searches the directories in the PATH environment variable on Windows for the application and the equivalent on Mac OS. - **_file_** (String) - Optional - File name to be opened. ### Return Values **Type:** Integer or nil A numeric value greater than 0, if successful; otherwise nil. ### Examples **Windows:** ``` (startapp "notepad" "acad.lsp") ``` **Windows (with embedded spaces in file name):** ``` (startapp "notepad.exe" "\"my stuff.txt\"") ``` **Mac OS:** ``` (startapp "textedit" "acad.lsp") ``` **Mac OS (with embedded spaces in file name):** ``` (startapp "textedit.app" "\"my stuff.txt\"") ``` ``` -------------------------------- ### Get MCS Start Point of a Line using assoc Source: https://help.autodesk.com/view/ACD/2025/ENU?guid=GUID-4F71D4FB-FBF4-4EB3-B546-24B8858FBB94&p=OARX Use `assoc` with entity data to retrieve the MCS start point of a line (group code 10) within a block definition. This requires obtaining the entity name first. ```autolisp (setq edata (assoc 10 (entget (car ndata)))) ``` ```autolisp (10 -1.0 1.0 0.0) ```