Create Quick Properties

By Xiaodong Liang

From product help:

When Quick Properties are switched on, you can view property information in a tooltip style window as you move your cursor over objects in the Scene View. You don’t need to select objects first. The quick properties tooltip disappears after a few seconds. By default, quick properties show the name and type of the object, but you can use the Options Editor to define which properties are shown. Each definition that you configure enables you to display an additional category/property combination in quick properties. You can choose whether to hide category names in quick properties or not.

image

image

 

In [Global Options] >> [Interface] >> [Quick Properties], you can add more definitions for the quick properties.

image

Currently, only COM API allows you to access and edit the quick properties. In API terminology, Quick Properties is called Smart Tag.

You can enable it by
   InwOpState3.SmartTagsEnabled

You can also get the smart tags of a path:   

   InwOpState4::SmartTagText  ( [in] InwOaPath *  path, 
                                                [out, retval] BSTR *  Text  
                                                )

The API cannot add more definition,  but it provides the ability to re-construct the definitions. The method is

   InwGlobalProperties::SetSmartTagsOpts ([in] InwSmartTagsOpts * pI )

InwSmartTagsOpts::Conditions can add various search conditions (definitions) .

The following is a small demo. It enable the quick properties,get the properties of the selected object, and re-construct the definitions with only one search condition.

  

void QuickProperties()    {        ComApi.InwOpState4 oState = ComApiBridge.ComApiBridge.State;                  //get the current selection        ModelItemCollection oModelColl =            Autodesk.Navisworks.Api.Application.                ActiveDocument.CurrentSelection.SelectedItems;             // simple demo: check the first model item only        if (oModelColl.Count > 0)        {            ModelItem oFirstItem = oModelColl[0];            ComApi.InwOaPath oPath =                ComApiBridge.ComApiBridge.ToInwOaPath(oFirstItem);                 // get the content of the display string            MessageBox.Show(oState.SmartTagText(oPath));        }             // re-construct the definitions             // create a new property tag property        ComApi.InwSmartTagsOpts oSmartTagOpt =             (ComApi.InwSmartTagsOpts)oState.ObjectFactory(            ComApi.nwEObjectType.eObjectType_nwSmartTagsOpts,            null,            null);             // the search condition of the property        ComApi.InwOpFindCondition oOpFindCond =             (ComApi.InwOpFindCondition)oState.ObjectFactory(            ComApi.nwEObjectType.eObjectType_nwOpFindCondition,            null,            null);             // clear the conditions if you re-use the existing InwSmartTagsOpts        //oSmartTagOpt.Conditions().Clear();             // demo: to display the property:        // Entity Handle >> Value             //set attribute name: use the internal name and user name together!                   oOpFindCond.SetAttributeNames("LcOpDwgEntityAttrib", "Entity Handle" );        //set property name: use the internal name and user name together!                   oOpFindCond.SetPropertyNames( "LcOaNat64AttributeValue", "Value" );        //search condition        oOpFindCond.Condition = ComApi.nwEFindCondition.eFind_HAS_PROP;         //add the condition to the InwSmartTagsOpts        oSmartTagOpt.Conditions().Add(oOpFindCond);        // add the InwSmartTagsOpts to global options        oState.GlobalProperties().SetSmartTagsOpts(oSmartTagOpt);             // display the properties        oState.SmartTagsEnabled = true;     }

Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading