Passing array of objects to Plugin Execute() method instead of array of strings

Passing array of objects to Plugin Execute() method instead of array of strings

HusseinOthman75
Enthusiast Enthusiast
1,525 Views
7 Replies
Message 1 of 8

Passing array of objects to Plugin Execute() method instead of array of strings

HusseinOthman75
Enthusiast
Enthusiast

A very crucial thing when using Navisworks plugin through C# Application (in my case) is the parameters passed from application to the plugin through calling Execute() method which is array of strings. The array of strings represents a bottleneck which limit the power of using Navisworks. For example with array of strings i can pass only the name of items to be selected in navisworks, but with passing array of objects i can pass the name, status, priority, ..... etc. for each array item, which give much pawer manipulating navisworks items : for example i can select items by name where status="Done" or Priority=1 or ..... etc. Is this option available? if not could we raise this substencial issue to Navisworks development team. Regards

0 Likes
Accepted solutions (1)
1,526 Views
7 Replies
Replies (7)
Message 2 of 8

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @HusseinOthman75 ,

 

A string can be JSON that you deserialize to obtain the desired data.

If this doesn't help, please let me know.

I will submit an improvement ticket for this issue.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 3 of 8

HusseinOthman75
Enthusiast
Enthusiast

Hi Naveen,

Thank you for your answer. Can you please drive an example , passing data to plug in as Json,

Regards

0 Likes
Message 4 of 8

HusseinOthman75
Enthusiast
Enthusiast

Hi Naveen,

Thank you for your answer. Can you please drive an example , passing data to plug in as Json,

Regards

0 Likes
Message 5 of 8

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @HusseinOthman75 ,

 

Please take a look at the attached files for the sample code. Here is the sample code to access an array of object data located in "Test" inside "Navisworks_2023"


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 6 of 8

HusseinOthman75
Enthusiast
Enthusiast

Hi Naveen,
Thank you very much for your help, highly appreciated. i applied the logic in your example but i recieve the following error :

nw.png

Note : This is a C# application. InvokeNavisworksPlugInTestPack1() method runs NavisworksApplication and Append

the the required model. then i invoke the plugin and pass the JSON string as shown. I tried to resolve this error

but to no avail. 

Thanks agin for you help.

0 Likes
Message 7 of 8

naveen.kumar.t
Autodesk Support
Autodesk Support
Accepted solution

Hi @HusseinOthman75 ,

 

I cannot replicate the issue on my end.

The attached sample code functions properly on my end.

Kindly refer to the attached files.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 8 of 8

HusseinOthman75
Enthusiast
Enthusiast
Hi naveen,
Thanks you for your technical support. The issue is resolved and your solution works perfectly
Regards
0 Likes