I am wondering how can find out in my app if the user are using the Revit viewer or running the actual Revit. I am using 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.
One possibility is to examine the contents of the Revit main window caption and determine whether it contains the words 'viewer':
http://thebuildingcoder.typepad.com/blog/2013/01/determine-revit-demo-mode-revisited.html
Look at the CmdDemoCheck
external command in The Building Coder samples .
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
Third and probably best suggestion: check the serial number. If Revit is running in demo mode, the serial number is 000-00000000:
http://thebuildingcoder.typepad.com/blog/2013/01/determine-revit-demo-mode-and-serial-number.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.