最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - How can I run Navisworks Manage with custom parameters in the command line (Windows)? - Stack Overflow

programmeradmin3浏览0评论

Description

Hi. I'm new to Navisworks API development, but I created a plugin to search and select models. It's very simple: it creates a DockPane that lets the user choose a category, a property and the value.

My goal is to have a server machine that listens to a port, locally starts Navisworks when it gets a request and automatically runs my plugin. I already managed to implement the first part with System.Diagnostics.Process.

ProcessStartInfo psi = new ProcessStartInfo
{
    FileName = NAVISWORKS_PATH,
    Arguments = $"\"{filePath}\"",
    UseShellExecute = true,
    CreateNoWindow = false
};
Process.Start(psi);

Now, I need the server to get both the file to open and the model to select as parameters, something like Arguments = $"\"{filePath}\" \"{modelId}\"",.

The problem is cannot get it to work, it tries to open {modelId} as another file. I found out about Navisworks Command Line Options and the -ExecuteAddinPlugin flag. I tried it, Navisworks runs the plugin but it doesn't open the file, so clearly I'm doing something wrong.

Please, help me understand how the Command Line Options works, or any other way if there is a better one. Thank you!

What I've tried

Configuration:

  • Windows 11
  • Visual Studio 2022
  • Windows Form Application template (.NET Framework 4.8)
  • Navisworks Manage 2023
  1. I tried:
ProcessStartInfo psi = new ProcessStartInfo
{
    FileName = NAVISWORKS_PATH,
    Arguments = $"\"{filePath}\"",
    UseShellExecute = true,
    CreateNoWindow = false
};
Process.Start(psi);

Navisworks opens the file.

  1. I tried:
ProcessStartInfo psi = new ProcessStartInfo
{
    FileName = NAVISWORKS_PATH,
    Arguments = $"\"{filePath}\" \"{modelId}\"",
    UseShellExecute = true,
    CreateNoWindow = false
};
Process.Start(psi);

Navisworks opens the file, but also tries to open modelId as another file.

  1. I tried:
ProcessStartInfo psi = new ProcessStartInfo
{
    FileName = NAVISWORKS_PATH,
    Arguments = $"\"-ExecuteAddinPlugin\" \"MyPlugin.MYORG\" \"{modelId}\" \"{modelPath}\"",
    UseShellExecute = true,
    CreateNoWindow = false
};
Process.Start(psi);

Navisworks starts and runs the plugin, but it doesn't open the file.

发布评论

评论列表(0)

  1. 暂无评论