如果获取Revit.ini文件在目标机器上的位置
问题:revit2008-revit2010中的二次开发要修改配置文件revit.ini,请问怎么确定它的位置?
答:
这个文件存储在Revit安装目录下。你可以通过注册表获得Revit的安装路径。请看下面的这个解决方案。前面部分关于RevitAddInUtility.dll 我在一篇博客中谈到
In 2011, we have introduced an external command/application registration utility dll called RevitAddInUtility.dll. It allows the developers to read, write and modify Revit Add-in manifest file (which is also new in 2011). You can also use it to identify the installation location of Revit product as well. The following are few of examples of classes and methods:
RevitProductUtility.GetAllInstalledRevitProducts --- get a list of Revit products installed on the machine.
RevitProduct.InstallLocation --- returns the folder path where the revit product is installed.
RevitAddinUtility.dll is a standalone tool and does not depend on other modules of Revit. Revit application developers can freely include it in their installers. (Note: at the time of updating this DevNote, this dll is found in the product install folder. We plan to make this available in other way in future.)
For more information, please take a look at RevitAddInUtility.chm documentation found in the Revit API SDK folder.
Now, if you are developing in Revit 2010 and earlier versions, unfortunately there is no utility. There is not an officially supported way for identifying the installation location of the Revit product install. You will need to check the uninstall information in the Windows system registry. The following is the information to use Uninstall information.
With some other products, typical location to find such information is Windows system registry. But Revit is designed to write into the Windows registry as little as possible. Though it adds some entries to the Windows registry at startup, it cleans up those entries when it exits.
Fortunately, Windows maintains some independent uninstall information in the registry, which we can use to detect some installation information such as the installation folder. The following are some of the Revit product uninstall keys - see further down below.
Revit 2012 Product Code Pattern
From Revit 2012 onwards, the Revit product codes are generated according to the following pattern:
{7346B4At-uuvv-wwxy-zzzz-705C0D862004}
The alphabetical characters above stand for
20. : ProductCode/UpgradeCode
21. : Major release version
22. : Release subversion
23. : RAC/RST/RME
24. : Win32/x64
25. : Global/Language Pack
26. : Language
The last item, represented by 'z', identifies the language. It uses the hexadecimal LCID (HEX LCID) and is defined in the following table:
lang .NET code HEX LCID DEC LCID Language name Codepage
chs zh-CN 0804 2052 Chinese Simplified 936
cht zh-TW 0404 1028 Chinese Traditional 950
csy cs-CZ 0405 1029 Czech 1250
deu de-DE 0407 1031 German 1252
enu en-US 0409 1033 English 1252
esp es-ES 040A 1034 Spanish 1252
fra fr-FR 040C 1036 French 1252
hun hu-HU 040E 1038 Hungarian 1250
ita it-IT 0410 1040 Italian 1252
jpn ja-JP 0411 1041 Japanese 932
kor ko-KR 0412 1042 Korean 949
plk pl-PL 0415 1045 Polish 1250
ptb pt-BR 0416 1046 Brazilian Portuguese 1252
rus ru-RU 0419 1049 Russian 1251
Applying this rule to Revit 2012 for the RAC flavour, 64 bit operating system, initial release and US English generates the following value:
{7346B4A0-1200-0110-0409-705C0D862004}
Revit 2012:
Revit Architecture 2012 (English) 32-bit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{7346B4A0-1200-0100-0409-705C0D862004}
Revit Structure 2012 (English): 32-bit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{7346B4A0-1200-0200-0409-705C0D862004}
Revit MEP 2012 (English):32-bit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{7346B4A0-1200-0300-0409-705C0D862004}
Revit Architecture 2012 (English) 64-bit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{7346B4A0-1200-0110-0409-705C0D862004}
Revit Structure 2012 (English): 64-bit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{7346B4A0-1200-0210-0409-705C0D862004}
Revit MEP 2012 (English):64-bit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{7346B4A0-1200-0310-0409-705C0D862004}
Revit 2011:
Revit Architecture 2011 (English) 32-bit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{4AF99FCA-1D0C-4D5A-9BFE-0D4376A52B23}
Revit Structure 2011 (English): 32-bit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{0EE1FCA9-7474-4143-8F22-E7AD998FACBF}
Revit MEP 2011 (English):32-bit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{CCCB80C8-5CC5-4EB7-89D0-F18E405F18F9}
Revit Architecture 2011 (English) 64-bit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{94D463D0-2B13-4181-9512-B27004B1151A}
Revit Structure 2011 (English): 64-bit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{23853368-22DD-4817-904B-DB04ADE9B0C8}
Revit MEP 2011 (English):64-bit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C31F3560-0007-4955-9F65-75CB47F82DB5}
Revit 2010:Revit Architecture 2010 (English): 64-bit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{{2A8EEE2F-4A9E-43D8-AA07-EC8A316B2DEB}}
Revit Structure 2010 (English): 64-bit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{{BC9C0A08-DEA4-4138-A7FB-8F68866DB0C1}}
Revit MEP 2010 (English):64-bit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{{5783F2D7-8006-0409-0102-0060B0CE6BBA}}
Revit Architecture 2010 (English) 32-bit:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{572FBF5D-3BAA-42FF-A468-A54C2C0A17C3}
Revit Structure 2010 (English) 32-bit:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{939D29FC-B82D-42A7-BB1E-8E3F121505CC}
Revit MEP 2010 (English) 32-bit:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5C8281B1-B927-495A-A0FF-AB4BDFAE505C}
Revit 2009:
Revit Architecture 2009 (English):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{A3A37DA6-70C0-497C-BCB1-148E9EC1D32E}
Revit MEP 2009 (both Chinese and English):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{E3781DCB-A650-4E66-9B74-67A1B17F052C}
Revit Structure 2009 (English):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C4B3B3C3-2EE9-48D3-9BF5-4443F7ECF759}
Revit 2008:
Revit Architecture 2008 (English):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{4A11206C-4377-49E8-911E-B11548658FF3}
Revit MEP 2008 (English):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{60A2743E-C881-4880-94ED-96445E38616F}
Revit Structure 2008 (English):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{8D0AE0BB-4FE5-491D-A284-3B363F02E639}
Revit 9.0 and Earlier:
Revit Building 9.0 (English):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{D11DB6CB-0332-4735-B312-B919741D975E}
Revit Structural 3 (English):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{3F11CEE0-D30D-41ce-8522-922B5D8BB324}
Revit Building 8.1 (English):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{7EBC0489-5E47-498D-BE31-B094484612E9}
Revit Structure 2 (English):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{BE814F63-629D-4fd8-B628-1437AC10F9D4}
You may want to explore further what entries are used for other Revit products, versions, and languages. Here is amethod to help us detect uninstall keys for other Revit products. Search for the product name under the key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
For instance, for Revit Architecture 2009, please search for "Revit Architecture 2009". The search result will be located in a key named "{A3A37DA6-70C0-497C-BCB1-148E9EC1D32E}". For any future version such as Revit Structure XYZ, search for "Revit Structure XYZ", to retrieve the corresponding key name.
Additionally, you can also get the MSI Package code or product code from the msi using, for example, Orca tool, which can be downloaded from several sites. When you open the msi using those tools, then you’ll find the ProductCode in the Property table.原文链接: http://blog.csdn.net/joexiongjin/article/details/7699790作者:叶雄进 , Autodesk ADN
赞一个
顶......
楼下跟上.....
顶!!!!!!!!!!!!!!!!!!!!!!!!!
页:
[1]