Hi,
I am try get list of the 3D model property to be used in our plugin. Currently, the list is getting created every time we call the plugin. Please suggest if it is possible to create the list of property when the document is opened and used the list in our plugin instead of creating the list on every plugin call.
Thanks,
Vinay
Solved! Go to Solution.
Solved by alexisDVJML. Go to Solution.
Solved by alexisDVJML. Go to Solution.
@upadhye.vinay , just want to clarify 2 things
What you mean by 'on every plugin call'.
Do you want to:
OR (and I would guess this is your goal)
What you mean by 'list of the 3D model property':
2.1 List of categories/properties names? or
2.2 List of all properties with their values. I will cover
NOTE: Below I cover only:
- the case of .NWD files and consider them readonly. .NWF support user categories/properties and are inherently read/write so an approach different than what I described below is required.
- the case 2.1
In both cases 1.1 and 1.2, you will need to keep as a field of your plugin something like this
public class CategoryDetails
{
public string mName;
public List<string> mPropertiesNames;
}
private List<CategoryDetails> mCategoriesDetails;
NOTE:
- if you use lists, like above, you can build it ordered which will come handy
- alternatively you can use Dictionaries if you want to be able to do quick check for an existing category/property
- you can combine both List/Dictionary/HashSet, depending on your exact use cases
In case 1.1/ you build this at document opening and use it during the session.
In case 1.2/ you store this in a dedicated file, format up to you, JSON, XML, .INI, .csv, saved in the same folder as the .NWD with a name based on the .NWD file name, ex: "Xxx.nwd.categories.json".
When a document is open, you check if such file exists:
- if yes, just load it, done.
- else find all categories/properties names and create said file.
Hope this covers at least in part your question 😉
@upadhye.vinay , You can look at this thread:
https://forums.autodesk.com/t5/navisworks-api/list-all-of-the-categories-in-the-model/m-p/3620658#M6...
Great to hear you achieved expected results 👍
Can't find what you're looking for? Ask the community or share your knowledge.