.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
2580 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