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: 

Unique Id/Guid in Selection Properties - com api

0 REPLIES 0
Reply
Message 1 of 1
Anonymous
631 Views, 0 Replies

Unique Id/Guid in Selection Properties - com api

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 REPLIES 0

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report