<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Adding User DataProperty using VBNet and COM API in Navisworks API Forum</title>
    <link>https://forums.autodesk.com/t5/navisworks-api-forum/adding-user-dataproperty-using-vbnet-and-com-api/m-p/3821583#M7097</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so, it looks you missed our blogs:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://adndevblog.typepad.com/aec/2012/05/create-attributes-and-properties-for-model-objects-using-net-api.html" target="_blank"&gt;http://adndevblog.typepad.com/aec/2012/05/create-attributes-and-properties-for-model-objects-using-net-api.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://adndevblog.typepad.com/aec/2012/08/addmodifyremove-custom-attribute-using-com-api.html" target="_blank"&gt;http://adndevblog.typepad.com/aec/2012/08/addmodifyremove-custom-attribute-using-com-api.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Apr 2013 03:21:59 GMT</pubDate>
    <dc:creator>xiaodong_liang</dc:creator>
    <dc:date>2013-04-03T03:21:59Z</dc:date>
    <item>
      <title>Adding User DataProperty using VBNet and COM API</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/adding-user-dataproperty-using-vbnet-and-com-api/m-p/3817040#M7096</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to add User Properties to an object, using VBNet and the COM API as it seems that the standard API doesn't provide any method for that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After reading the few available samples of COM API on that forum and some of the documentation, I still can't figure it out and it all seems very confusing. Is there step by step sample or more detailed documentation somewhere about using the COM API with VB.Net?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I looked at this &lt;A href="https://forums.autodesk.com/t5/Autodesk-Navisworks-API/Unable-to-add-custom-properties-to-all-desired-modelitems/m-p/3781660/highlight/true#M804" target="_self"&gt;sample&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but there are some structure that I don't know how to translate in VBNet (the (...)state part):&lt;/P&gt;&lt;PRE&gt;ComApi.InwGUIPropertyNode2 propn =
		(ComApi.InwGUIPropertyNode2)state.GetGUIPropertyNode(oPath, true)&lt;/PRE&gt;&lt;P&gt;is that it?&lt;/P&gt;&lt;PRE&gt;Dim Propn As InwGUIPropertyNode2 = state.GetGUIPropertyNode(COMmi, True)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and some missing piece of code that I can't figure out, the one defining the new Property to add (newPvec) in the sample. I checked the documentation but I don't get it... (attached is a sample of things I don't get from the documentation)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2013 06:07:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/adding-user-dataproperty-using-vbnet-and-com-api/m-p/3817040#M7096</guid>
      <dc:creator>ngombault</dc:creator>
      <dc:date>2013-03-28T06:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: Adding User DataProperty using VBNet and COM API</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/adding-user-dataproperty-using-vbnet-and-com-api/m-p/3821583#M7097</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so, it looks you missed our blogs:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://adndevblog.typepad.com/aec/2012/05/create-attributes-and-properties-for-model-objects-using-net-api.html" target="_blank"&gt;http://adndevblog.typepad.com/aec/2012/05/create-attributes-and-properties-for-model-objects-using-net-api.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://adndevblog.typepad.com/aec/2012/08/addmodifyremove-custom-attribute-using-com-api.html" target="_blank"&gt;http://adndevblog.typepad.com/aec/2012/08/addmodifyremove-custom-attribute-using-com-api.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2013 03:21:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/adding-user-dataproperty-using-vbnet-and-com-api/m-p/3821583#M7097</guid>
      <dc:creator>xiaodong_liang</dc:creator>
      <dc:date>2013-04-03T03:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: Adding User DataProperty using VBNet and COM API</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/adding-user-dataproperty-using-vbnet-and-com-api/m-p/3821630#M7098</link>
      <description>&lt;P&gt;Much appreciated, as always.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for the record, the VBNet solution goes like that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Imports Autodesk.Navisworks.Api
Imports Autodesk.Navisworks.Api.ComApi
Imports Autodesk.Navisworks.Api.Interop.ComApi


    Public Sub AddProperty()

        'Get the COM Bridge to manipulate Properties
        Dim state As Interop.ComApi.InwOpState10 = ComApiBridge.State

        'Create the New Category and Property
        Dim newPropertyCategory As InwOaPropertyVec = state.ObjectFactory(nwEObjectType.eObjectType_nwOaPropertyVec, Nothing, Nothing)
        Dim newProperty As InwOaProperty = state.ObjectFactory(nwEObjectType.eObjectType_nwOaProperty, Nothing, Nothing)
        newProperty.name = "Prop Name"
        newProperty.UserName = "Prop Display Name"
        newProperty.value = "Prop Value"

        'Add the new Property to the Category
        newPropertyCategory.Properties.Add(newProperty)

        'Get the selected model item, its COM path, and its list of PropertyCategories
        Dim mi As ModelItem = Autodesk.Navisworks.Api.Application.ActiveDocument.CurrentSelection.SelectedItems(0)
        Dim miPath As InwOaPath = ComApiBridge.ToInwOaPath(mi)
        Dim PropertyCategories As InwGUIPropertyNode2 = state.GetGUIPropertyNode(miPath, True)

        'Add the new Category (PropertyVector) to the modelitem
        PropertyCategories.SetUserDefined(0, "Tab Display Name", "Tab Name", newPropertyCategory)

    End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;-Nic&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2013 05:55:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/adding-user-dataproperty-using-vbnet-and-com-api/m-p/3821630#M7098</guid>
      <dc:creator>ngombault</dc:creator>
      <dc:date>2013-04-03T05:55:29Z</dc:date>
    </item>
  </channel>
</rss>

