.NET
cancel
Showing results forĀ 
ShowĀ Ā onlyĀ  | Search instead forĀ 
Did you mean:Ā 

How to get the "Support File Search Path" with code?

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
karea
2575 Views, 11 Replies

How to get the "Support File Search Path" with code?

Hi:

I would like to get de  "Support File Search Path" and "Working Support File Search Path" from Option in menu "Tools".

 

With VBA the name of dictionay was `DWGPROPS' and I used

 

Const DICTIONARY_NAME = "DWGPROPS"

Set DwgInfo = ThisDrawing.Dictionaries(DICTIONARY_NAME)

DwgInfo.GetXRecordData DataType, Data


but with .NET the dictionary name isnĀ“t "DWGPROPS"

 

thanks

11 REPLIES 11
Message 2 of 12
C_Witt
in reply to: karea

ApplicationServices.Application.AcadApplication.Preferences.files.SupportPath

 

same for all the other "options"..

ApplicationServices.Application.AcadApplication.Preferences.files.____________

Message 3 of 12
Alexander.Rivilis
in reply to: C_Witt

Another way is:

string support_path = Application.GetSystemVariable("ACADPREFIX") as string;

Š’Ń–Š“ŠæŠ¾Š²Ń–Š“ь ŠŗŠ¾Ń€ŠøсŠ½Š°? ŠšŠ»Ń–ŠŗŠ½Ń–Ń‚ŃŒ Š½Š° "Š’ŠŸŠžŠ”ŠžŠ‘ŠŠ™ŠšŠ£" ціŠ¼ ŠæŠ¾Š²Ń–Š“Š¾Š¼Š»ŠµŠ½Š½ŃŠ¼! | Do you find the posts helpful? "LIKE" these posts!
ŠŠ°Ń…Š¾Š“ŠøтŠµ сŠ¾Š¾Š±Ń‰ŠµŠ½Šøя ŠæŠ¾Š»ŠµŠ·Š½Ń‹Š¼Šø? ŠŸŠ¾ŃŃ‚Š°Š²ŃŒŃ‚Šµ "ŠŠ ŠŠ’Š˜Š¢Š”ŠÆ" этŠøŠ¼ сŠ¾Š¾Š±Ń‰ŠµŠ½ŠøяŠ¼!
ŠŠ° Š²Š°ŃˆŠµ Š·Š°ŠæŠøтŠ°Š½Š½Ń Š²Ń–Š“ŠæŠ¾Š²Ń–Š»Šø? ŠŠ°Ń‚ŠøсŠ½Ń–Ń‚ŃŒ ŠŗŠ½Š¾ŠæŠŗу "ŠŸŠ Š˜Š™ŠŠÆŠ¢Š˜ Š Š†ŠØŠ•ŠŠŠÆ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
ŠŠ° Š²Š°Ńˆ Š²Š¾ŠæрŠ¾Ń усŠæŠµŃˆŠ½Š¾ Š¾Ń‚Š²ŠµŃ‚ŠøŠ»Šø? ŠŠ°Š¶Š¼ŠøтŠµ ŠŗŠ½Š¾ŠæŠŗу "Š£Š¢Š’Š•Š Š”Š˜Š¢Š¬ Š Š•ŠØŠ•ŠŠ˜Š•"


Alexander Rivilis / ŠŠ»ŠµŠŗсŠ°Š½Š“р Š ŠøŠ²ŠøŠ»Šøс / ŠžŠ»ŠµŠŗсŠ°Š½Š“р Š Ń–Š²Ń–Š»Ń–с
Programmer & Teacher & Helper / ŠŸŃ€Š¾Š³Ń€Š°Š¼Š¼Šøст - Š£Ń‡ŠøтŠµŠ»ŃŒ - ŠŸŠ¾Š¼Š¾Ń‰Š½ŠøŠŗ / ŠŸŃ€Š¾Š³Ń€Š°Š¼Ń–ст - Š²Ń‡ŠøтŠµŠ»ŃŒ - ŠæŠ¾Š¼Ń–чŠ½ŠøŠŗ
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 4 of 12
karea
in reply to: karea

it is easier than it thought!

 

thaks,

 

Message 5 of 12
StormyC
in reply to: Alexander.Rivilis

ACADPREFIX 

 

Is there a way to edit this programatically?  ie add some file support paths?

Message 6 of 12
qi.zuo
in reply to: C_Witt

how can i get the exact code for other list folders, for example"Automatic SAve File Location"

Message 7 of 12
gphanauer
in reply to: qi.zuo

string autoSavePath = Application.GetSystemVariable("SAVEFILEPATH") as string;
Message 8 of 12
norman.yuan
in reply to: qi.zuo

 Not all file paths in the "Options->Files" dialog box have a corresponding system variables. If the ones you need to reach as corresponding system variables, such as "automatic save location", then using system variable "SAVEFILEPATH", as @gphanauer suggested, would be easy and simple. For others, you can reach them by

 

Application.Preferences, which is an AcadObject (COM API object).

 

So the code would be like:

 

dynamic preferences = Autodesk.AutoCAD.ApplicationServices.Application.Preferences;

var autoSavePath = (string)preferences.Files.AutoSavePath;

var supportPath = (string)preferences.Files.SupportPath;      // paths separated with ";"

var teplatePath = (string)preferences.Files.TemplateDwgPath.

... ...

 

 

Norman Yuan

Drive CAD With Code

EESignature

Message 9 of 12
qi.zuo
in reply to: gphanauer

Thankx.
But i want to have it in the form
ApplicationServices.Application.AcadApplication.Preferences.files.____________, what should i give? I have tried with AutoSavePath but doesnt work
Message 10 of 12
qi.zuo
in reply to: norman.yuan

Thx.
But i have tried for "Automatic Save File Location" with "Application.AcadApplication.Preferences.files.AutoSavePath", it turned to be invalid argument.
Message 11 of 12
gphanauer
in reply to: qi.zuo

You need to better explain what you want to do.

Are you using a listbox on windows forms? Exactly what do you want to add?

It is best to post the code.

Message 12 of 12
qi.zuo
in reply to: gphanauer

I was using a python node in Dynamo to add new file path to Options under different list folders. What i want is how should i change the code "SupportPath" in order to add new path under the list folders "Automatic Save File Location" and "Temporary External Reference File Location". Here is my code in a Python node:

# Load the Python Standard and DesignScript Libraries
import sys
import clr
# Add Assemblies for AutoCAD and Civil3D
clr.AddReference('AcMgd')
clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')
# Import references from AutoCAD
from Autodesk.AutoCAD.Runtime import *
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.EditorInput import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *
# Import references from Civil3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *

path = IN[0]
Application.AcadApplication.Preferences.Files.SupportPath += ā€œ;ā€ + path
OUT = Application.AcadApplication.Preferences.Files.SupportPath.ToString().split(";")

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

ā€Boost