简体   繁体   English

如何确定是正在运行的Revit Viewer还是Revit本身Revit API

[英]How to find out if it is Revit viewer which is running or Revit itself Revit api

I am wondering how can find out in my app if the user are using the Revit viewer or running the actual Revit. 我想知道如果用户正在使用Revit查看器或正在运行实际的Revit,如何在我的应用程序中查找。 I am using c# 我正在使用C#

This works for me: 这对我有用:

string[] args = Environment.GetCommandLineArgs();
if (args.Contains("/viewer"))
    ...

This is how the Revit Viewer shortcut works, and how I most often start Revit through VS, to keep a license free. 这就是Revit Viewer快捷方式的工作方式,也是我最常通过VS启动Revit来保持许可证免费的方式。

One possibility is to examine the contents of the Revit main window caption and determine whether it contains the words 'viewer': 一种可能性是检查Revit主窗口标题的内容并确定其是否包含单词“ viewer”:

http://thebuildingcoder.typepad.com/blog/2013/01/determine-revit-demo-mode-revisited.html http://thebuildingcoder.typepad.com/blog/2013/01/determine-revit-demo-mode-revisited.html

Look at the CmdDemoCheck external command in The Building Coder samples . 查看“建筑编码器”样本中的CmdDemoCheck外部命令。

You can also try to modify the current document; 您也可以尝试修改当前文档。 if that is possible, it is definitely not in viewer mode: 如果有可能,则绝对不在查看器模式下:

http://thebuildingcoder.typepad.com/blog/2012/03/determine-revit-demo-mode.html http://thebuildingcoder.typepad.com/blog/2012/03/determine-revit-demo-mode.html

Third and probably best suggestion: check the serial number. 第三,也是最好的建议:检查序列号。 If Revit is running in demo mode, the serial number is 000-00000000: 如果Revit以演示模式运行,则序列号为000-00000000:

http://thebuildingcoder.typepad.com/blog/2013/01/determine-revit-demo-mode-and-serial-number.html http://thebuildingcoder.typepad.com/blog/2013/01/determine-revit-demo-mode-and-serial-number.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM