i am using .net apis.
i am looping through a model and finding a certain item type, then i am looping through the properties in that item type. i am getting the property name and value but im struggling to find out how to tell if that property is hidden or not. Im referring to if a user selects the element the item type is assigned to and in the properties dialog doing a right click > hide on a given property in the item type.
//testing BD.DgnFile activeFile = Bentley.MstnPlatformNET.Session.Instance.GetActiveDgnFile(); BD.DgnModel activemodel = Bentley.MstnPlatformNET.Session.Instance.GetActiveDgnModel(); BD.ModelElementsCollection eleCol = activemodel.GetGraphicElements(); foreach (Element curEle in eleCol) { if (curEle.ElementType == Bentley.DgnPlatformNET.MSElementType.CellHeader) { Bentley.DgnPlatformNET.CustomItemHost host = new Bentley.DgnPlatformNET.CustomItemHost(curEle, true); IList<BD.DgnEC.IDgnECInstance> fields = host.CustomItems; foreach (BD.DgnEC.IDgnECInstance curField in fields) { if (curField.ClassDefinition.Name.ToUpper().Contains("OHDOT_SHEET")) {//found foreach (var curprop in curField) { if(curprop.SOMETHING TO CHECK IF HIDDEN) {//hidden } } } } } }
John Drsek said:im struggling to find out how to tell if that property is hidden
Item Type properties are data, not graphics. The question: "Is an Item Type property hidden?" doesn't make sense.
You can query Item Type instance properties using the relevant user tools. You may have designed a cell having text, of which some may contain text fields. You may have text fields that display Item Type properties.
The variable names you have chosen to use are misleading. Here's a fragment of your code with some names changed...
Bentley.DgnPlatformNET.CustomItemHost host = new Bentley.DgnPlatformNET.CustomItemHost(curEle, true); IList<BD.DgnEC.IDgnECInstance> instances = host.CustomItems; foreach (BD.DgnEC.IDgnECInstance instance in instances) { if (instance.ClassDefinition.Name.ToUpper().Contains("OHDOT_SHEET")) { foreach (var property in instance) { if(property.SOMETHING TO CHECK IF HIDDEN) { } } } }
Your code is finding each Item Type instance on a host cell. For each instance you enumerate its properties. You want to test property.SOMETHING TO CHECK IF HIDDEN, but no such test exists.
property.SOMETHING TO CHECK IF HIDDEN
Regards, Jon Summers LA Solutions
Jon, he's asking how to detect if the user has used the right-click (context) menu option to hide individual properties.
John, nothing related to this is exposed through the public SDK.
that's what I was afraid of...
Maybe you can describe what you're trying to accomplish from a user perspective?
I have one Item Type that is used on our sheet cells. it has a property for each thing that can be filled out on the sheet things like page, page total, title... but we have a 20 different sheet cells with different properties shown. so one sheet cell doesn't have every property in the item type. so on each cell I hid the properties not in use, so when the user selects that cell they only see the properties that are associated with a text element in the cell.
I then have a addin that manages all these sheets and allows the user to easily edit/bulk edit the properties, rather then having to go to a specific file and edit it. it saves a lot of time.
I had this written in v8i using tag sets and this was no problem to tell If a tag was there or not, but since item types are the way to go im switching over to item types.
For now I just made the value equal to -1 on all the properties that I hid, and in my code if the value is -1 I wont show that property.
Hi John,
in my opinion you try to use Item Types for the scenario where EC data with custom EC schema should work better. Item Types are based on one specific EC schema, but when you create own EC schema, there is much better flexibility what and how can be defined.
If I remember right, one from standard EC property attributes (modifiers) provides a functionality "do not display this property when is not used (is empty)". So you would receive required functionality automatically (I should test it whether I am right ;-).
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
I know this is quite an old post, but just in case anyone goes looking for an answer to this (as I just did), here is how you can check if a property is "hidden":
using Bentley.ECObjects.UI; ... bool isHidden = ECPropertyPane.IsHidden(myProperty);