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

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

Anonymous
不适用
3,364 次查看
11 条回复
1 条消息(共 12 条)

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

Anonymous
不适用

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

0 个赞
已接受的解答 (1)
3,365 次查看
11 条回复
回复 (11)
2 条消息(共 12 条)

Anonymous
不适用

ApplicationServices.Application.AcadApplication.Preferences.files.SupportPath

 

same for all the other "options"..

ApplicationServices.Application.AcadApplication.Preferences.files.____________

0 个赞
3 条消息(共 12 条)

Alexander.Rivilis
Mentor
Mentor
已接受的解答

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

4 条消息(共 12 条)

Anonymous
不适用

it is easier than it thought!

 

thaks,

 

0 个赞
5 条消息(共 12 条)

StormyC
Advocate
Advocate

ACADPREFIX 

 

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

0 个赞
6 条消息(共 12 条)

Anonymous
不适用

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

0 个赞
7 条消息(共 12 条)

Gepaha
Collaborator
Collaborator
string autoSavePath = Application.GetSystemVariable("SAVEFILEPATH") as string;
0 个赞
8 条消息(共 12 条)

norman.yuan
Mentor
Mentor

 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 @Gepaha 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

9 条消息(共 12 条)

Anonymous
不适用
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
0 个赞
10 条消息(共 12 条)

Anonymous
不适用
Thx.
But i have tried for "Automatic Save File Location" with "Application.AcadApplication.Preferences.files.AutoSavePath", it turned to be invalid argument.
0 个赞
11 条消息(共 12 条)

Gepaha
Collaborator
Collaborator

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.

0 个赞
12 条消息(共 12 条)

Anonymous
不适用
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(";")
0 个赞