### Implement Start Method in Plugin Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-150D5213-1015-4361-AB6B-6683362F9AB7 Example implementation of the Start method within a plugin to handle standards checking. ```VB.NET Public Sub PlugIn_Start(ByVal pStartError As AcStError) _ Implements IAcStPlugin2.Start ' pStartError is not an actual programming error that needs to be handled, ' but a reference to an object that does not match the standards ' in the DWS file. ' If pStartError is an object, checking should start ' from that error, not the beginning of the current context. If IsNothing(pStartError) = False Then ' Get the ObjectId of the first object to check Dim badId As Long = pStartError.BadObjectId ' Find the index for ObjectId in the context list stored in m_objIDArray For m_curIndex = 0 To m_ContextList.Count - 1 If m_ContextList.Item(m_curIndex) = badId Then m_curIndex = m_curIndex - 1 PlugIn_Next() End If Next Else ' A valid AcStError object was not passed to the method. ' Checking should start at the beginning of the context list. m_curIndex = -1 PlugIn_Next() End If End Sub ``` ```C# public void PlugIn_Start(AcStError pStartError) { // pStartError is not an actual programming error that needs to be handled, // but a reference to an object that does not match the standards // in the DWS file. // If pStartError is an object, checking should start // from that error, not the beginning of the current context. if ((pStartError == null) == false) { // Get the ObjectId of the first object to check long badId = pStartError.BadObjectId; // Find the index for ObjectId in the context list stored in m_objIDArray for (m_curIndex = 0; m_curIndex <= m_ContextList.Count - 1; m_curIndex++) { if (Convert.ToInt64(m_ContextList.GetItem(m_curIndex)) == badId) { m_curIndex = m_curIndex - 1; PlugIn_Next(); } } } else { // A valid AcStError object was not passed to the method. // Checking should start at the beginning of the context list. m_curIndex = -1; PlugIn_Next(); } } void IAcStPlugin2.Start(AcStError pStartError) { PlugIn_Start(pStartError); } ``` -------------------------------- ### Initialize Command Version Example Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=OARX-RefGuide-acedGetCommandVersion Example usage showing the initialization of a command version. ```cpp Adesk::UInt8 commandVersion = acedInitCommandVersion(); ``` -------------------------------- ### Get or Create Excel Application Example Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-7AFF597F-D630-4489-8349-94EF67CCE1F0 Example demonstrating the retrieval or creation of an Excel application object. ```AutoLISP (vlax-get-or-create-object "Excel.Application") # ``` -------------------------------- ### Implement PlugIn_Start using BadObjectId Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-00013936-2FF5-4683-A2E0-E9C1684D526D Example implementation of the PlugIn_Start method using the BadObjectId property to determine the starting point for standards checking. ```vbnet Public Sub PlugIn_Start(ByVal pStartError As AcStError) _ Implements IAcStPlugin2.Start ' If pStartError is an object, checking should start ' from that error, not the beginning of the current context. If IsNothing(pStartError) = False Then ' Get the ObjectId of the first object to check Dim badId As Long = pStartError.BadObjectId ' Find the index for ObjectId in the context list stored in m_objIDArray For m_curIndex = 0 To m_ContextList.Count - 1 If m_ContextList.Item(m_curIndex) = badId Then m_curIndex = m_curIndex - 1 PlugIn_Next() End If Next Else ' A valid AcStError object was not passed to the method. ' Checking should start at the beginning of the context list. m_curIndex = -1 PlugIn_Next() End If End Sub ``` ```csharp public void PlugIn_Start(AcStError pStartError) { // If pStartError is an object, checking should start // from that error, not the beginning of the current context. if ((pStartError == null) == false) { // Get the ObjectId of the first object to check long badId = pStartError.BadObjectId; // Find the index for ObjectId in the context list stored in m_objIDArray for (m_curIndex = 0; m_curIndex <= m_ContextList.Count - 1; m_curIndex++) { if (Convert.ToInt64(m_ContextList.GetItem(m_curIndex)) == badId) { m_curIndex = m_curIndex - 1; PlugIn_Next(); } } } else { // A valid AcStError object was not passed to the method. // Checking should start at the beginning of the context list. m_curIndex = -1; PlugIn_Next(); } } ``` -------------------------------- ### SetupForAudit Implementation Example Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-0F6EBB70-088B-407F-9B29-1B6507083E4A Example demonstrating how to retrieve ModelSpaceProxy and PaperSpaceProxy within an IAcStPlugin2.SetupForAudit implementation. ```vbnet Public Sub SetupForAudit(ByVal pDb As AcadDatabase, _ ByVal szPathName As String, _ ByVal stdNameArray As Object, _ ByVal stdPathArray As Object, _ ByVal stdDbArray As Object) _ Implements IAcStPlugin2.SetupForAudit ' Number of graphical objects contained in model space and paper space of ' the database being checked If Not IsNothing(pDb) Then Dim msProxy As IAcStBlockProxy = m_pManager.ModelSpaceProxy(pDb) Dim psProxy As IAcStBlockProxy = m_pManager.PaperSpaceProxy(pDb) Debug.Print("Object counts " & vbLf & "Model: " & msProxy.Count.ToString() & vbLf & "Paper: " & psProxy.Count.ToString()) End If End Sub ``` ```csharp public void SetupForAudit(AcadDatabase pDb, string szPathName, object stdNameArray, object stdPathArray, object stdDbArray) { // Number of graphical objects contained in model space and paper space of // the database being checked if (pDb != null) { IAcStBlockProxy msProxy = m_pManager.get_ModelSpaceProxy(pDb); IAcStBlockProxy psProxy = m_pManager.get_PaperSpaceProxy(pDb); Debug.Print("Object counts \nModel: " + msProxy.Count.ToString() + "\nPaper: " + psProxy.Count.ToString()); } } ``` -------------------------------- ### Brep.GetShellsStartingFrom(Shell startFrom) Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=OARX-ManagedRefGuide-Autodesk_AutoCAD_BoundaryRepresentation_Brep_GetShellsStartingFrom_Shell Returns a collection of shells starting from a starting point. ```APIDOC ## Brep.GetShellsStartingFrom ### Description Returns a collection of shells starting from a starting point. ### Syntax **C#** public BrepShellCollection GetShellsStartingFrom(Shell startFrom); **Visual Basic** Public Function GetShellsStartingFrom(startFrom As Shell) As BrepShellCollection ### Parameters - **startFrom** (Shell) - Required - Input shell to start collecting from ### Returns - **BrepShellCollection** - A collection of shells starting from the specified input shell. ``` -------------------------------- ### Start a transaction Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=OARX-RefGuide-actrTransactionManager Example usage of the actrTransactionManager macro to initiate a transaction. ```cpp actrTransactionManager->startTransaction(); ``` -------------------------------- ### Registering Help for a Command Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=OARX-RefGuide-acedSetFunHelp_ACHAR__ACHAR__ACHAR__int Example demonstrating how to register help for a custom function immediately after defining it with acedDefun. ```cpp int funcload() { char* exfun = "c:sld2ps"; if (acedDefun(exfun, 0) != RTNORM) return 0; if (acedSetFunHelp(exfun, "sld2ps.chm" "sld2ps", 0) != RTNORM) return 0; return 1; } ``` -------------------------------- ### Brep.GetComplexsStartingFrom(Complex startFrom) Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=OARX-ManagedRefGuide-Autodesk_AutoCAD_BoundaryRepresentation_Brep_GetComplexsStartingFrom_Complex Returns a collection of complexes starting from a starting point. ```APIDOC ## Brep.GetComplexsStartingFrom ### Description Returns a collection of complexes starting from a starting point. ### Signature `public BrepComplexCollection GetComplexsStartingFrom(Complex startFrom)` ### Parameters - **startFrom** (Complex) - Required - Input complex to start collecting from ### Returns - **BrepComplexCollection** - A collection of complexes starting from the specified point. ``` -------------------------------- ### ImportProfile Method Examples Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-7C7D0F4F-06BE-400E-9E28-14E02AA9A93A Examples demonstrating how to import a profile using VBA and Visual LISP. ```VBA Sub Example_ImportProfile() ' This example imports a profile. ' NOTE: A dummy profile name is used so that your existing ' profiles are not changed. Dim preferences As AcadPreferences Dim strProfileToImport As String Set preferences = ThisDrawing.Application.preferences ' Specify the profile to delete. strProfileToImport = "TestProfile" ' Delete the profile ' The call will fail if "TestProfile" does not exist On Error GoTo Error preferences.Profiles.ImportProfile strProfileToImport, "TESTPROFILE.ARG", True Exit Sub Error: MsgBox "ImportProfile of " & strProfileToImport & " failed. " & Err.Description, , "ImportProfile Example" End Sub ``` ```Visual LISP (vl-load-com) (defun c:Example_ImportProfile() ;; This example imports a profile. ;; NOTE: A dummy profile name is used so that your existing ;; profiles are not changed. (setq acadObj (vlax-get-acad-object)) (setq preferences (vla-get-Preferences acadObj)) ;; Specify the profile to import. (setq strProfileToImport "TestProfile") (vla-ImportProfile (vla-get-Profiles preferences) strProfileToImport (findfile "TESTPROFILE.ARG") :vlax-true) ) ``` -------------------------------- ### Create a Sphere Example Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-A80673FC-C26A-4CC8-9893-219154FFE59F Examples demonstrating the creation of a sphere in model space and updating the viewport. ```VBA Sub Example_AddSphere() ' This example creates a sphere in model space. Dim sphereObj As Acad3DSolid Dim centerPoint(0 To 2) As Double Dim radius As Double centerPoint(0) = 5#: centerPoint(1) = 5#: centerPoint(2) = 0# radius = 5# Set sphereObj = ThisDrawing.ModelSpace.AddSphere(centerPoint, radius) ' Change the viewing direction of the viewport Dim NewDirection(0 To 2) As Double NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1 ThisDrawing.ActiveViewport.direction = NewDirection ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport ZoomAll End Sub ``` ```Visual LISP (vl-load-com) (defun c:Example_AddSphere() ;; This example creates a sphere in model space. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Define the solid sphere (setq centerPoint (vlax-3d-point 5 5 0) radius 5) (setq modelSpace (vla-get-ModelSpace doc)) (setq sphereObj (vla-AddSphere modelSpace centerPoint radius)) ;; Change the viewing direction of the viewport (setq NewDirection (vlax-3d-point -1 -1 1)) (setq activeViewport (vla-get-ActiveViewport doc)) (vla-put-Direction activeViewport NewDirection) (vla-put-ActiveViewport doc activeViewport) (vla-ZoomAll acadObj) ) ``` -------------------------------- ### Brep.GetFacesStartingFrom(Face startFrom) Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=OARX-ManagedRefGuide-Autodesk_AutoCAD_BoundaryRepresentation_Brep_GetFacesStartingFrom_Face Returns a collection of faces starting from a starting point. ```APIDOC ## Brep.GetFacesStartingFrom ### Description Returns a collection of faces starting from a starting point. ### Syntax #### C# public BrepFaceCollection GetFacesStartingFrom(Face startFrom); #### Visual Basic Public Function GetFacesStartingFrom(startFrom As Face) As BrepFaceCollection ### Parameters - **startFrom** (Face) - Required - Input face to start collecting from ### Returns - **BrepFaceCollection** - A collection of faces starting from the specified face. ``` -------------------------------- ### RunMacro Example Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-638E14CA-798C-42BC-8F2B-5E9D6952C707 Examples demonstrating how to load a DVB file, run a macro, and unload the file. ```VBA Sub Example_RunMacro() ' This example loads a DVB file and runs a macro ' contained in the file using the RunMacro method. ' ' This example uses a DVB file named drawline.dvb. ' You should change the example to use a file on your computer. ' ' * Note: If you open a DVB file and then run the example to load it, there will be an error ' when the DVB file is unloaded. Dim FileName As String FileName = "c:\drawline.dvb" ' Load a sample VBA project DVB file LoadDVB FileName ' Run the drawline sample macro RunMacro "Module1.Drawline" ' Unload the drawline VBA project DVB file now that we are done UnloadDVB FileName MsgBox "The DVB file has been run!" End Sub ``` ```Visual LISP (vl-load-com) (defun c:Example_RunMacro() ;; This example loads a DVB file and runs a macro ;; contained in the file using the RunMacro method. ;; ;; This example uses a DVB file named drawline.dvb. ;; You should change the example to use a file on your computer. ;; ;; * Note: If you open a DVB file and then run the example to load it, there will be an error ;; when the DVB file is unloaded. (setq acadObj (vlax-get-acad-object)) (setq fileName (findfile ".\\Sample\\VBA\\drawline.dvb")) ;; Load a sample VBA project DVB file (vla-LoadDVB acadObj fileName) ;; Run the drawline sample macro (vla-RunMacro acadObj "Module1.Drawline") ;; Unload the drawline VBA project DVB file now that we are done (vla-UnloadDVB acadObj fileName) (alert "The DVB file has been run!") ) ``` -------------------------------- ### Determine Curve Start Parameter Example Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-854C3C4D-1305-4920-9E42-D9ACB9E4363C Example usage of vlax-curve-getStartParam to determine the start parameter of an ellipse object. ```AutoLISP (vlax-curve-getstartparam ellipseObj) 0.0 ``` -------------------------------- ### Example Startup Script Content Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-5510017F-4656-478F-BD4C-AB6B1998BF55 A sample script file named _setup.scr_ that configures grid, linetype scale, and layer settings. ```text grid on ltscale 3.0 layer set 0 color red 0 ``` -------------------------------- ### EndAngle Property Example Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-5F2762C5-A24D-4A35-92F3-AC31311BE503 Examples demonstrating how to create an elliptical arc by setting the start and end angles. ```VBA Sub Example_EndAngle() ' This example creates an ellipse and enters the start and ' end angles to create an elliptical arc. Dim ellObj As AcadEllipse Dim majAxis(0 To 2) As Double Dim center(0 To 2) As Double Dim radRatio As Double ' Create an ellipse in model space center(0) = 5#: center(1) = 5#: center(2) = 0# majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0# radRatio = 0.3 Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio) 'Enter a start angle of 45 degrees, and an end angle of 270 degrees ellObj.startAngle = 45 * (3.14 / 180) ellObj.endAngle = 270 * (3.14 / 180) ZoomAll MsgBox "This ellipse has a start angle of " & ellObj.startAngle * (180 / 3.14) & " and the end angle of " & ellObj.endAngle * (180 / 3.14) & " degrees.", vbInformation, "EndAngle Example" End Sub ``` ```Visual LISP (vl-load-com) (defun c:Example_EndAngle() ;; This example creates an ellipse and enters the start and ;; end angles to create an elliptical arc. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Create an ellipse in model space (setq center (vlax-3d-point 5 5 0) majAxis (vlax-3d-point 10 20 0) radRatio 0.3) (setq modelSpace (vla-get-ModelSpace doc)) (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio)) ;; Enter a start angle of 45 degrees, and an end angle of 270 degrees (vla-put-StartAngle ellObj (* 45 (/ 3.14 180))) (vla-put-EndAngle ellObj (* 270 (/ 3.14 180))) (vla-ZoomAll acadObj) (alert (strcat "This ellipse has a start angle of " (rtos (* (vla-get-StartAngle ellObj) (/ 180 3.14)) 2) " and the end angle of " (rtos (* (vla-get-EndAngle ellObj) (/ 180 3.14)) 2) " degrees.")) ) ``` -------------------------------- ### Shell.GetFacesStartingFrom(Face startFrom) Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=OARX-ManagedRefGuide-Autodesk_AutoCAD_BoundaryRepresentation_Shell_GetFacesStartingFrom_Face Returns a collection of faces starting from a starting point. ```APIDOC ## Shell.GetFacesStartingFrom ### Description Returns a collection of faces starting from a starting point. ### Signature `public ShellFaceCollection GetFacesStartingFrom(Face startFrom)` ### Parameters - **startFrom** (Face) - Required - Input face to start collecting from ### Returns - **ShellFaceCollection** - A collection of faces starting from the specified face. ``` -------------------------------- ### Example: Setting StartParameter Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-E7C085E0-22CA-4E96-83A5-F8672277340E Examples demonstrating how to create an ellipse and set its start and end parameters to define an arc. ```VBA Sub Example_StartParameter() ' This example creates an ellipse and enters the start and ' end parameters to create an elliptical arc. Dim ellObj As AcadEllipse Dim majAxis(0 To 2) As Double Dim center(0 To 2) As Double Dim radRatio As Double ' Create an ellipse in model space center(0) = 5#: center(1) = 5#: center(2) = 0# majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0# radRatio = 0.3 Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio) ' Enter a start parameter of 1.57, and an end parameter of 6.28 ellObj.StartParameter = 1.57 ellObj.EndParameter = 6.28 ZoomAll ' Find the start and end parameters for the ellipse MsgBox "The ellipse has a start parameter of " & ellObj.StartParameter & " and an end parameter of " & ellObj.EndParameter, vbInformation, "StartParameter Example" End Sub ``` ```Visual LISP (vl-load-com) (defun c:Example_StartParameter() ;; This example creates an ellipse and enters the start and ;; end parameters to create an elliptical arc. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Create an ellipse in model space (setq center (vlax-3d-point 5 5 0) majAxis (vlax-3d-point 10 20 0) radRatio 0.3) (setq modelSpace (vla-get-ModelSpace doc)) (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio)) ;; Enter a start parameter of 1.57, and an end parameter of 6.28 (vla-put-StartParameter ellObj 1.57) (vla-put-EndParameter ellObj 6.28) (vla-ZoomAll acadObj) ;; Find the start and end parameters for the ellipse (alert (strcat "The ellipse has a start parameter of " (rtos (vla-get-StartParameter ellObj) 2) " and an end parameter of " (rtos (vla-get-EndParameter ellObj) 2))) ) ``` -------------------------------- ### Create a directory using vl-mkdir Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-02D5CC9E-9394-4630-AE14-133F5F03D7B1 Examples demonstrating directory creation on different operating systems. ```AutoLISP (vl-mkdir "c:\\mydirectory") ``` ```AutoLISP (vl-mkdir "/mydirectory") ``` -------------------------------- ### SetView Method Examples Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-A56246A7-65B5-4B62-9AF4-BD2FDC27FF1C Examples demonstrating how to create a new view, define its properties, and apply it to the active viewport. ```vba Sub Example_SetView() ' This example creates a new view. ' It then changes the active viewport to ' the newly created view. ' Create a new view Dim viewObj As AcadView Set viewObj = ThisDrawing.Views.Add("TESTVIEW") ' Set the view characteristics viewObj.center(0) = 374: viewObj.center(1) = 313 viewObj.Width = 450 viewObj.Height = 354 ' Get the current active viewport Dim viewportObj As AcadViewport Set viewportObj = ThisDrawing.ActiveViewport MsgBox "Change to the saved view.", , "SetView Example" ' Set the view in the viewport viewportObj.SetView viewObj ThisDrawing.ActiveViewport = viewportObj ThisDrawing.Regen True End Sub ``` ```visual-lisp (vl-load-com) (defun c:Example_SetView() ;; This example creates a new view. ;; It then changes the active viewport to ;; the newly created view. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Create a new view (setq viewObj (vla-Add (vla-get-Views doc) "TESTVIEW")) ;; Set the view characteristics (setq centerPoint (vlax-make-safearray vlax-vbDouble '(0 . 1))) (vlax-safearray-fill centerPoint '(374 313)) (vla-put-Center viewObj centerPoint) (vla-put-Width viewObj 450) (vla-put-height viewObj 354) ; Get the current active viewport (setq viewportObj (vla-get-ActiveViewport doc)) (alert "Change to the saved view.") ;; Set the view in the viewport (vla-SetView viewportObj viewObj) (vla-put-ActiveViewport doc viewportObj) (vla-Regen doc :vlax-true) ) ``` -------------------------------- ### PlotToDevice Method Examples Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-55FEED17-E697-4CF3-B9C3-6ACCF060672F Examples demonstrating how to configure the layout and initiate a plot to a device using VBA and Visual LISP. ```VBA Sub Example_PlotToDevice() ' This example sends a plot of the current drawing ' to the default device for your system. ThisDrawing.ActiveLayout.ConfigName = "DWF6 ePlot.pc3" ThisDrawing.Plot.PlotToDevice End Sub ``` ```Visual LISP (vl-load-com) (defun c:Example_PlotToDevice() ;; This example sends a plot of the current drawing ;; to the current device. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) (vla-put-ConfigName (vla-get-ActiveLayout doc) "DWF6 ePlot.pc3") (vla-PlotToDevice (vla-get-Plot doc)) ) ``` -------------------------------- ### Extended Entity Definition Data Example Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-A2A628B0-3699-4740-A215-C560E7242F63 Example of extended data (xdata) structure following an entity definition, starting with the 1001 group code. ```text 1001 AME_SOL 1002 { 1070 0 1071 1.95059E+06 1070 519 1010 2.54717 1020 2.122642 1030 2.049201 1005 ECD 1005 EE9 1005 0 1040 0.0 1040 1.0 1000 MILD_STEEL ``` -------------------------------- ### Read and Write Registry Examples Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-0B9E26CF-2410-482E-B568-7FE05B9F013C Examples demonstrating reading from a registry key, writing data to it, and reading the updated value. ```AutoLISP (vl-registry-read "HKEY_CURRENT_USER\Test") nil (vl-registry-write "HKEY_CURRENT_USER\Test" "" "test data") "test data" (vl-registry-read "HKEY_CURRENT_USER\Test") "test data" ``` -------------------------------- ### AssocArrayPolarParameters.StartAngle Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=OARX-ManagedRefGuide-Autodesk_AutoCAD_DatabaseServices_AssocArrayPolarParameters_StartAngle Gets or sets the start angle for the polar array parameters in degrees. ```APIDOC ## Property: StartAngle ### Description Gets or sets the start angle of the polar array. The value is measured in degrees. ### Signature - **C#**: public double StartAngle - **Visual Basic**: Public Property StartAngle() As double ### Conditions - **Access**: Read / Write ``` -------------------------------- ### ScaleEntity Method Examples Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-F5A968AB-47BC-4D86-A04D-5985FF217596 Examples demonstrating how to create a polyline and apply the ScaleEntity method to resize it. ```VBA Sub Example_ScaleEntity() ' This example creates a lightweight polyline ' and then scales that polyline. ' Create the polyline Dim plineObj As AcadLWPolyline Dim points(0 To 11) As Double points(0) = 1: points(1) = 2 points(2) = 1: points(3) = 3 points(4) = 2: points(5) = 3 points(6) = 3: points(7) = 3 points(8) = 4: points(9) = 4 points(10) = 4: points(11) = 2 Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points) plineObj.Closed = True ZoomAll MsgBox "Scale the polyline by 0.5", , "ScaleEntity Example" ' Define the scale Dim basePoint(0 To 2) As Double Dim scalefactor As Double basePoint(0) = 4: basePoint(1) = 4.25: basePoint(2) = 0 scalefactor = 0.5 ' Scale the polyline plineObj.ScaleEntity basePoint, scalefactor ZoomAll MsgBox "Scale completed.", , "ScaleEntity Example" End Sub ``` ```Visual LISP (vl-load-com) (defun c:Example_ScaleEntity() ;; This example creates a lightweight polyline ;; and then scales that polyline. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Create the polyline (setq points (vlax-make-safearray vlax-vbDouble '(0 . 11))) (vlax-safearray-fill points '(1 2 1 3 2 3 3 3 4 4 4 2 ) ) (setq modelSpace (vla-get-ModelSpace doc)) (setq plineObj (vla-AddLightWeightPolyline modelSpace points)) (vla-put-Closed plineObj :vlax-true) (vla-ZoomAll acadObj) (alert "Scale the polyline by 0.5") ;; Define the scale (setq basePoint (vlax-3d-point 4 4.25 0) scalefactor 0.5) ;; Scale the polyline (vla-ScaleEntity plineObj basePoint scalefactor) (vla-ZoomAll acadObj) (alert "Scale completed.") ) ``` -------------------------------- ### Add Method Examples Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-6DB6EFDF-C393-4BD0-9E59-A57BCDA3456F Examples demonstrating the creation of various drawing objects by adding them to their respective collections. ```APIDOC ## Add Method Usage ### Description The Add method is used to create and append new objects to specific collections within the current drawing, such as Blocks, Layers, or Groups. ### Examples #### Add Block ```vba Set blockObj = ThisDrawing.Blocks.Add(insertionPnt, "New_Block") ``` #### Add Dictionary ```vba Set dictObj = ThisDrawing.Dictionaries.Add("New_Dictionary") ``` #### Add Dimension Style ```vba Set DimStyleObj = ThisDrawing.DimStyles.Add("New_Dimstyle") ``` #### Add Group ```vba Set groupObj = ThisDrawing.Groups.Add("New_Group") ``` #### Add Layer ```vba Set layerObj = ThisDrawing.Layers.Add("New_Layer") ``` #### Add Registered Application ```vba Set RegAppObj = ThisDrawing.RegisteredApplications.Add("New_RegApp") ``` ``` -------------------------------- ### AssocBlendSurfaceActionBody.StartEdgeContinuity Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=OARX-ManagedRefGuide-Autodesk_AutoCAD_DatabaseServices_AssocBlendSurfaceActionBody_StartEdgeContinuity Gets or sets the start edge continuity for the blend surface action body. ```APIDOC ## Property: StartEdgeContinuity ### Description Gets or sets the start edge continuity value for the AssocBlendSurfaceActionBody. This property wraps the ObjectARX AcDbAssocBlendSurfaceActionBody::startEdgeContinuity() and AcDbAssocBlendSurfaceActionBody::setStartEdgeContinuity() methods. ### Signature - **C#**: public short StartEdgeContinuity; - **Visual Basic**: Public Property StartEdgeContinuity() As short ### Namespace Autodesk.AutoCAD.DatabaseServices ``` -------------------------------- ### Implement SetupForAudit in VB.NET Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-CE5219B4-CE8D-4318-B4FD-69FD9036B91C This method initializes the plug-in context by caching the database to be checked and iterating through DWS files to cache standards information. Do not store references to the DWS database objects as they may become invalid. ```VB.NET Public Sub SetupForAudit(ByVal pDb As AcadDatabase, _ ByVal szPathName As String, _ ByVal stdNameArray As Object, _ ByVal stdPathArray As Object, _ ByVal stdDbArray As Object) _ Implements IAcStPlugin2.SetupForAudit ' Used to define the context which the plug-in will operate. ' The drawing to be checked and the DWS files being used are passed ' to the plug-in at this point. Store the DWS standards definitions ' and the objects to be checked. The GetObjectFilter() method is used ' to specify the object type that the plug-in should check for errors. ' WARNING!: Do not save a reference to the database object, ' as it may not be valid going forward. If Not IsNothing(pDb) Then ' Store a reference to the DWG to be checked m_pCheckDatabase = pDb ' Verify the reference to the DWG is valid object If Not IsNothing(m_pCheckDatabase) Then ' << Change based on standards implementation >> For Each acObj As AcadObject In m_pCheckDatabase.Layers If acObj.ObjectName = "AcDbLayerTableRecord" Then m_ContextList.Add(acObj.ObjectID, True) End If Next End If Dim iDWS As Integer ' Iterate each of the DWS files and cache the objects to use to fix errors For iDWS = 0 To UBound(stdDbArray) ' Get the DWS database m_pDWSDatabase = stdDbArray(iDWS) ' << Change based on standards implementation >> Dim pStdLayer As AcadLayer ' Iterate the layers in the database Dim i As Integer = 0 For Each pStdLayer In m_pDWSDatabase.Layers Dim layerCache As New LayerCache() ' Cache the properties of the layers in the DWS database layerCache.Name = pStdLayer.Name layerCache.Color = pStdLayer.color layerCache.Lineweight = pStdLayer.Lineweight layerCache.StandardFileName = stdNameArray(iDWS) ' Create a fix object to be used later to correct a standards violation Dim pFix As New AcStFix() pFix.Description = "Layer fix" pFix.StandardFileName = layerCache.StandardFileName pFix.FixObjectName = pStdLayer.Name If pFix.PropertyCount = 0 Then pFix.PropertyValuePut("Color", pStdLayer.color) pFix.PropertyValuePut("Lineweight", pStdLayer.Lineweight) End If layerCache.StandardsFix = pFix ReDim Preserve m_LayerCacheArray(i) m_LayerCacheArray(i) = layerCache layerCache = Nothing pFix = Nothing i = i + 1 Next m_pDWSDatabase = Nothing Next End If End Sub ``` -------------------------------- ### Example of pop-error-mode usage Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-60AFEFAD-1DF5-448F-A2E9-D7260DB279E4 Demonstrates how to use pop-error-mode within a custom error handler setup. ```AutoLISP (defun my_err (err_msg) (if (/= err_msg "Function cancelled") (prompt (strcat "\nError: " err_msg)) ) (command "._undo" "_e") (command "._U") (setq *error* olderr) (princ) ) (defun myUtil (key / ) (setq olderr *error* *error* my_err) (*push-error-using-command*) ; Indicate use of the command function instead of command-s ; in a custom error handler (command "._undo" "_group") ; The following will not be executed in this sample, but is good ; framework for setting up your own error handlers (/ 1 0) ; Call a function with incorrect values to trigger the custom error handler ; Remove when setting up your code ;; Perform your tasks here (command "._undo" "_e") (setq *error* olderr) ; Restore old *error* handler (*pop-error-mode*) ; End the use of *push-error-using-command* ) ``` -------------------------------- ### Create a 3D Cone Example Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-95CCDBE3-C787-4FF5-AE5F-A94B0F2DF505 Examples demonstrating how to create a 3D solid cone and adjust the viewport to view it. ```VBA Sub Example_AddCone() ' This example creates a cone in model space. Dim coneObj As Acad3DSolid Dim radius As Double Dim center(0 To 2) As Double Dim height As Double ' Define the cone center(0) = 0#: center(1) = 0#: center(2) = 0# radius = 5# height = 20# ' Create the Cone (3DSolid) object in model space Set coneObj = ThisDrawing.ModelSpace.AddCone(center, radius, height) ' Change the viewing direction of the viewport to better see the cone Dim NewDirection(0 To 2) As Double NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1 ThisDrawing.ActiveViewport.direction = NewDirection ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport ZoomAll End Sub ``` ```Visual LISP (vl-load-com) (defun c:Example_AddCone() ;; This example creates a cone in model space. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Define the cone (setq center (vlax-3d-point 0 0 0) coneRadius 5 coneHeight 20) ;; Create the Cone (3DSolid) object in model space (setq modelSpace (vla-get-ModelSpace doc)) (setq coneObj (vla-AddCone modelSpace center coneRadius coneHeight)) ;; Change the viewing direction of the viewport to better see the cone (setq NewDirection (vlax-3d-point -1 -1 1)) (setq activeViewport (vla-get-ActiveViewport doc)) (vla-put-Direction activeViewport NewDirection) (vla-put-ActiveViewport doc activeViewport) (vla-ZoomAll acadObj) ) ``` -------------------------------- ### Property Promotion Examples Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-A65FBCCF-CC5D-47E8-9117-D577D9CB9D8A Comparison of output format for StartPoint property based on the context parameter. ```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 ``` -------------------------------- ### Get RCS file path in C++ Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=OARX-RefGuide-AcDbPointCloudDefEx__getRcsFilePath_AcString__const Retrieves the file path for a given RCS GUID. ```cpp const TCHAR* getRcsFilePath( const AcString& guid ) const; ``` -------------------------------- ### GetUCSMatrix Example Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-85495614-C788-45C7-8E26-2BC8A2C3A490 Examples demonstrating how to create a UCS, retrieve its transformation matrix, and apply it to a circle object. ```VBA Sub Example_GetUCSMatrix() ' This example creates a new UCS and finds the UCS matrix for it. ' It then creates a circle using WCS coordinates and ' transforms the circle for the UCS. ' Define a new UCS and turn on the UCS icon at the origin. Dim ucsObj As AcadUCS Dim origin(0 To 2) As Double Dim xAxisPoint(0 To 2) As Double Dim yAxisPoint(0 To 2) As Double origin(0) = 2: origin(1) = 2: origin(2) = 0 xAxisPoint(0) = 3: xAxisPoint(1) = 2: xAxisPoint(2) = 0 yAxisPoint(0) = 2: yAxisPoint(1) = 3: yAxisPoint(2) = 0 Set ucsObj = ThisDrawing.UserCoordinateSystems.Add(origin, xAxisPoint, yAxisPoint, "UCS1") ThisDrawing.ActiveUCS = ucsObj ThisDrawing.ActiveViewport.UCSIconOn = True ThisDrawing.ActiveViewport.UCSIconAtOrigin = True ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport ' Create a circle using WCS coordinates Dim circleObj As AcadCircle Dim center(0 To 2) As Double Dim radius As Double center(0) = 1: center(1) = 1: center(2) = 0 radius = 0.5 Set circleObj = ThisDrawing.ModelSpace.AddCircle(center, radius) ZoomAll ' Get the UCS transformation matrix Dim TransMatrix As Variant TransMatrix = ucsObj.GetUCSMatrix() ' Transform the circle to the UCS coordinates MsgBox "Transform the circle.", , "GetUCSMatrix Example" circleObj.TransformBy (TransMatrix) circleObj.Update MsgBox "The circle is transformed.", , "GetUCSMatrix Example" End Sub ``` ```Visual LISP (vl-load-com) (defun c:Example_GetUCSMatrix() ;; This example creates a new UCS and finds the UCS matrix for it. ;; It then creates a circle using WCS coordinates and ;; transforms the circle for the UCS. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Define a new UCS and turn on the UCS icon at the origin. (setq origin (vlax-3d-point 2 2 0) xAxisPoint (vlax-3d-point 3 2 0) yAxisPoint (vlax-3d-point 2 3 0)) (setq ucsObj (vla-Add (vla-get-UserCoordinateSystems doc) origin xAxisPoint yAxisPoint "UCS1")) (vla-put-ActiveUCS doc ucsObj) (vla-put-UCSIconOn (vla-get-ActiveViewport doc) :vlax-true) (vla-put-UCSIconAtOrigin (vla-get-ActiveViewport doc) :vlax-true) (vla-put-ActiveViewport doc (vla-get-ActiveViewport doc)) ;; Create a circle using WCS coordinates (setq center (vlax-3d-point 1 1 0) radius 0.5) (setq modelSpace (vla-get-ModelSpace doc)) (setq circleObj (vla-AddCircle modelSpace center radius)) (vla-ZoomAll acadObj) ;; Get the UCS transformation matrix (setq TransMatrix (vla-GetUCSMatrix ucsObj)) ;; Transform the circle to the UCS coordinates (alert "Transform the circle.") (vla-TransformBy circleObj TransMatrix) (vla-Update circleObj) (alert "The circle is transformed.") ) ``` -------------------------------- ### Invoking Help Calls Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=OARX-RefGuide-acedHelp_ACHAR__ACHAR__int Examples demonstrating how to trigger help for specific commands or custom help files. ```cpp _/* Bring up Help for the TRIM command in AutoCAD Help (by default acad.chm) */_ acedHelp(NULL, "trim", 0); _/* Bring up Help for the topic my_dialog in the file myfile.chm. */_ acedHelp("myfile.chm", "my_dialog", 0); ``` -------------------------------- ### AssocBlendSurfaceActionBody.StartEdgeBulge Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=OARX-ManagedRefGuide-Autodesk_AutoCAD_DatabaseServices_AssocBlendSurfaceActionBody_StartEdgeBulge Gets or sets the start edge bulge value for the blend surface action body. ```APIDOC ## Property: StartEdgeBulge ### Description Gets or sets the start edge bulge value for the AssocBlendSurfaceActionBody. This property wraps the ObjectARX AcDbAssocBlendSurfaceActionBody::startEdgeBulge() and AcDbAssocBlendSurfaceActionBody::setStartEdgeBulge() methods. ### Signature - **C#**: public double StartEdgeBulge; - **Visual Basic**: Public Property StartEdgeBulge() As double ### Namespace Autodesk.AutoCAD.DatabaseServices ``` -------------------------------- ### Startup Script with Template Syntax Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-5510017F-4656-478F-BD4C-AB6B1998BF55 Command line syntax for creating a new drawing from a template and executing a script file immediately after. ```text _executable_path_ /t MyTemplate /b setup ``` ```text _executable_path_ -t MyTemplate -b setup ``` -------------------------------- ### BeginShortcutMenuOSnap Event Implementation Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-A244B425-3107-4F3B-97C6-229FCA1286EA An example of intercepting the shortcut menu start while in osnap mode using VBA. ```VBA Private Sub AcadDocument_BeginShortcutMenuOSnap(ShortcutMenu As AutoCAD.IAcadPopupMenu) ' This example intercepts a shortcut menu start while you are in the osnap mode. ' MsgBox "You have just initiated a shortcut menu in osnap mode!" End Sub ``` -------------------------------- ### Get Lower Boundary of Safearray Dimensions Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-8ABBA8A8-D421-48D2-BCBC-34DA1C728A78 Retrieves the starting index for the first and second dimensions of a safearray. ```AutoLISP (vlax-safearray-get-l-bound tmatrix 1) ``` ```AutoLISP (vlax-safearray-get-l-bound tmatrix 2) ``` -------------------------------- ### Handle BeginShortcutMenuGrip Event in VBA Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-6E178381-061D-48FB-95C9-3D077AB1A1EF An example of intercepting the shortcut menu start while in grip mode using VBA. ```VBA Private Sub AcadDocument_BeginShortcutMenuGrip(ShortcutMenu As AutoCAD.IAcadPopupMenu) ' This example intercepts a shortcut menu start while you are in the grip mode. ' MsgBox "You have just initiated a shortcut menu in grip mode!" End Sub ``` -------------------------------- ### Using acdbGetPreviewBitmapFromDwg to Display a Preview Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=OARX-RefGuide-acdbGetPreviewBitmapFromDwg_ACHAR__HBITMAP__HPALETTE_ Example demonstrating how to call the function and render the resulting bitmap and palette to a device context. ```cpp HBITMAP hBitmap; HPALETTE hPal; acdbGetPreviewBitmapFromDwg("foo.dwg", &hBitmap, &hPal); _// Palette_ CPalette* oldPal = pDC->SelectPalette(CPalette::FromHandle(hPal),TRUE); pDC->RealizePalette(); CBitmap bm; bm.Attach(hBitmap); CDC dcMem; dcMem.CreateCompatibleDC(pDC); CBitmap *pOldBitmap = dcMem.SelectObject(&bm); pDC->BitBlt(0, 0, 1000,1000, &dcMem, 0, 0, SRCCOPY); dcMem.SelectObject(pOldBitmap); pDC->SelectPalette(oldPal,TRUE ); pDC->RealizePalette(); bm.DeleteObject(); DeleteObject(hBitmap); DeleteObject(hPal); ``` -------------------------------- ### Start Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=OARX-ManagedRefGuide-__MEMBERTYPE_Methods_Autodesk_AutoCAD_Runtime_ProgressMeter Initializes the progress meter. ```APIDOC ## Start ### Description Initializes and starts the progress meter display. ``` -------------------------------- ### Example Command Script File Source: https://help.autodesk.com/view/OARX/2026/ENU?guid=GUID-9F648910-2D8C-4AED-B796-FD977D52872E A sample script file demonstrating command execution and the use of comments to document script actions. ```text ; Turn grid on grid on ; Set scale for linetypes ltscale 3.0 ; Set current layer and its color layer set 0 color red 0 ; Blank line above to end the LAYER command ```