Community
Navisworks API
Welcome to Autodesk’s Navisworks API Forums. Share your knowledge, ask questions, and explore popular Navisworks API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Navisworks Manage Automation API ExecuteAddIn Plugin

1 REPLY 1
Reply
Message 1 of 2
pranjali.padghan
410 Views, 1 Reply

Navisworks Manage Automation API ExecuteAddIn Plugin

Is it possible to pass command line argument to a plugin through  Automation API ?

For example, I want to pass NoGui as an argument through API for am in house plugin.

 

Labels (3)
1 REPLY 1
Message 2 of 2
jabowabo
in reply to: pranjali.padghan

Yes, this is the way I do it:


// add args
//  - create a dictionary first to make more understandable then convert to arg array
Dictionary<string, string> argDict = new Dictionary<string, string>();
argDict.Add("targetFile", masterNwfFile);
argDict.Add("p3dXmlFile", np.ProjectXmlFile);
argDict.Add("doImportP3d", np.ImportP3d.ToString());
argDict.Add("doImportAdvStl", np.ImportAdvStl.ToString());
// erase all saved viewpoints
//  - any viewpoints that were created in AutoCAD will be erased
//  - previously saved Navisworks viewpoints will need to be imported manually
argDict.Add("doClearViewpoints", "true");

// create the arg array
List<string> argList = new List<string>();
_Debug.AppendLine($"\t\t\t argList:");
foreach (var kvp in argDict)
{
	_Debug.AppendLine($"\t\t\t\t {kvp.Key}:\t{kvp.Value}");
	argList.Add($"{kvp.Key};{kvp.Value}");
}

// run the plugin
NavAutoApp.ExecuteAddInPlugin("KpeNavisTools.JABO", argList.ToArray());

 

Plugin:

public override int Execute(params string[] parameters)
	{
		// get param values as dict
		Dictionary<string, string> paramsDict = new Dictionary<string, string>();
		foreach (string param in parameters)
		{
			string key = param.GetStringSplit(';', 0);
			string val = param.GetStringSplit(';', 1);
			paramsDict.Add(key, val);
		}

		// report dict values
		Debug.AppendLine($"\tparamsDict:");
		foreach (var kvp in paramsDict)
		{
			Debug.AppendLine($"\t\t{kvp.Key}: {kvp.Value}");
		}
	}

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report