Active Contributor
Posts: 28
Registered: ‎01-31-2014
Message 1 of 5 (314 Views)
Accepted Solution

Add Support paths via DLL vb.net

314 Views, 4 Replies
04-15-2014 02:33 AM

I have created a ribbon and would like to add the support path's in to autocad when the ribbon is loaded


I only want to add the Support path if it has not already been added


I would want to add somthing like


C:\Program files\Folder1

C:\Program files\Folder2

C:\Program files\Folder3

C:\Program files\Folder4


But if folder 3 was already there for some reason i would like it to skip folder3 and then add the other ones that wernt aready there

Valued Mentor
Posts: 433
Registered: ‎01-12-2008
Message 2 of 5 (291 Views)

Re: Add Support paths via DLL vb.net

04-15-2014 05:11 AM in reply to: makepeace1

Try with this code.


Public Sub Set_Path()
        Dim acad_pref As AcadPreferences = Autodesk.AutoCAD.ApplicationServices.Application.Preferences
        Dim C_Paths As String = LCase(acad_pref.Files.SupportPath)

        Dim Old_Path_Ary As List(Of String) = New List(Of String)
        Old_Path_Ary = C_Paths.Split(";").ToList

        Dim New_paths As List(Of String) = New List(Of String)

        New_paths.Add("C:\Program files\Folder1")
        New_paths.Add("C:\Program files\Folder2")
        New_paths.Add("C:\Program files\Folder3")
        New_paths.Add("C:\Program files\Folder4")

        For Each Str As String In New_paths
            If Not Old_Path_Ary.Contains(Str) Then
            End If

        acad_pref.Files.SupportPath = String.Join(";", Old_Path_Ary.ToArray())

    End Sub


Active Contributor
Posts: 28
Registered: ‎01-31-2014
Message 3 of 5 (278 Views)

Re: Add Support paths via DLL vb.net

04-15-2014 06:15 AM in reply to: Ajilal.Vijayan

I also want to add the trusted locations if the version of autocad is 2014 or above


I have done this in a lsp file but how would i do it in the dll ?


(if (>= (getvar "ACADVER") "19.1")
(setvar "trustedpaths" (strcat (getvar "trustedpaths")




Valued Mentor
Posts: 433
Registered: ‎01-12-2008
Message 4 of 5 (261 Views)

Re: Add Support paths via DLL vb.net

04-15-2014 08:06 AM in reply to: makepeace1
Valued Contributor
Posts: 61
Registered: ‎12-09-2013
Message 5 of 5 (212 Views)

Re: Add Support paths via DLL vb.net

04-18-2014 06:30 AM in reply to: Ajilal.Vijayan

Just adding my two cents.  Working through the Options tabs to consolidate a stock configuration for our office.  A few differences in setting various paths.

    <CommandMethod("setconfig")> _
    Public Sub setconfig()
        Dim acpref As AcadPreferences = Application.Preferences
        Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
            'Misc Variables
            Application.SetSystemVariable("filedia", 1)
            Application.SetSystemVariable("gridmode", 0)
            Application.SetSystemVariable("copymode", 0)
            acDoc.Window.WindowState = Window.State.Maximized
            acpref.System.BeepOnError = False
            Application.SetSystemVariable("trustedpaths", ";C:\Forum_ACAD\2014\;" & ";R:\2014\;")

            acpref.Files.SupportPath = ";C:\Forum_ACAD\2014\" & ";R:\2014\;" & acpref.Files.SupportPath

            'acpref.Files.EnterpriseMenuFile = "R:\2014\Menus\Forum-2014.cuix"
            acpref.Files.PrinterConfigPath = "R:\2014\Plotters\"

            acpref.Files.PrinterDescPath = "R:\2014\Plotters\"
            acpref.Files.PrintSpoolerPath = "C:\Temp\"
            acpref.Files.PrinterStyleSheetPath = "R:\2014\Plotters\"

            acpref.Files.TemplateDwgPath = "R:\2014\Templates\"
            acpref.Files.QNewTemplateFile = "R:\2014\Templates\file-types.dwt"

            acpref.Files.TempFilePath = "C:\Temp\"

            acpref.Display.DisplayScrollBars = False
            acpref.Display.XRefFadeIntensity = 50
            acpref.Display.GraphicsWinModelBackgrndColor = 0
            acpref.Display.CursorSize = 100
            acpref.Display.LayoutDisplayPaperShadow = False
            'acpref.Display.ModelCrosshairColor = "Color 42"

            'Open Save
            acpref.OpenSave.SaveAsType = Autodesk.AutoCAD.Interop.Common.AcSaveAsType.ac2013_dwg
            acpref.OpenSave.SavePreviewThumbnail = False
            acpref.OpenSave.AutoSaveInterval = False
            acpref.OpenSave.IncrementalSavePercent = 0
            acpref.OpenSave.CreateBackup = False
            acpref.OpenSave.FullCRCValidation = True
            acpref.OpenSave.LogFileOn = False
            acpref.OpenSave.DemandLoadARXApp = Autodesk.AutoCAD.Interop.Common.AcARXDemandLoad.acDemandLoadOnObjectDetect
            acpref.OpenSave.AutoAudit = True
            acpref.OpenSave.ShowProxyDialogBox = False
            acpref.OpenSave.TempFileExtension = "ac$"
            acpref.OpenSave.XrefDemandLoad = Autodesk.AutoCAD.Interop.Common.AcXRefDemandLoad.acDemandLoadEnabled
            acpref.OpenSave.ProxyImage = False

            ''Plot and Publish
            acpref.Output.AutomaticPlotLog = False
            acpref.Output.ContinuousPlotLog = False
            acpref.Output.DefaultOutputDevice = "Adobe PDF"
            Application.SetSystemVariable("BackGroundPlot", 0)
            Application.SetSystemVariable("AutomaticPub", 0)

            acpref.Drafting.AutoTrackTooltip = False
            acpref.Drafting.AutoSnapTooltip = False
            acpref.Drafting.AlignmentPointAcquisition = 0
        Catch ex As Exception
        End Try
    End Sub


Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.