Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Unique Id/Guid in Selection Properties - com api

Anonymous

Unique Id/Guid in Selection Properties - com api

Anonymous
Not applicable

Hi

 

I have this code (for com api) to access the Properties of a individual Selection.

It gives me something similar to what is in NW Manage or Simulate.

Sometimes a selection has properties of a unique Id like a Guid or an Id, but it seems to be optional for each Navisworks file.

 

Is there such a thing as a mandatory Unique Id for an individual selection in a Navisworks file? Or am I limited to using the InwOaPath as a sort-of-unique Id?

 

        public void Dump(nw.InwOpSelection sel, out Dictionary<string, List<nw.InwOaProperty>> propertiesWithClass)
        {
            propertiesWithClass = new Dictionary<string, List<nw.InwOaProperty>>();

            foreach (nw.InwOaPath path in sel.Paths())
            {
                var propertyNode = (nw.InwGUIPropertyNode2)_state.GetGUIPropertyNode(path, true);
                foreach (nw.InwGUIAttribute2 attribute in propertyNode.GUIAttributes())
                {
                    try
                    {
                        var properties = new List<nw.InwOaProperty>();
                        string classUsername = attribute.ClassUserName;

                        foreach (nw.InwOaProperty p in attribute.Properties())
                        {
                            var property =
                            (nw.InwOaProperty)_state.ObjectFactory(nw.nwEObjectType.eObjectType_nwOaProperty, null, null);
                            property.UserName = p.UserName;
                            property.value = p.value;
                            properties.Add(property);
                        }
                        if (!propertiesWithClass.ContainsKey(attribute.ClassUserName))
                        {
                            propertiesWithClass.Add(attribute.ClassUserName, properties);
                        }
                    }
                    catch (Exception e)
                    {
                        System.Windows.Forms.MessageBox.Show(e.Message + e.StackTrace);
                    }
                }
            }

0 Likes
Reply
711 Views
0 Replies
Replies (0)