<?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 Create a custom SelectionSet, which selects only Objects originating from Advance Steel in Navisworks API Forum</title>
    <link>https://forums.autodesk.com/t5/navisworks-api-forum/create-a-custom-selectionset-which-selects-only-objects/m-p/12575830#M726</link>
    <description>&lt;P&gt;Hello! Through the SOftware, we have the option of importing an XML file into the SelectionSet. I was trying to do the same through the API, but I did not find any method that allowed me to import this XML file through the .NET API.&lt;/P&gt;&lt;P&gt;I was developing the code below, I managed to create the SelectionSet, but it still does not return the selected items according to the category and property.&lt;/P&gt;&lt;P&gt;I'll leave my XML code below for review, and my .NET code that I was developing.&lt;/P&gt;&lt;P&gt;I'm waiting!&lt;BR /&gt;&lt;BR /&gt;XML:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;?xml version="1.0" encoding="UTF-8" ?&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;exchange xmlns:xsi="&lt;A href="http://www.w3.org/2001/XMLSchema-instance" target="_blank"&gt;http://www.w3.org/2001/XMLSchema-instance&lt;/A&gt;" xsi:noNamespaceSchemaLocation="&lt;A href="http://download.autodesk.com/us/navisworks/schemas/nw-exchange-12.0.xsd" target="_blank"&gt;http://download.autodesk.com/us/navisworks/schemas/nw-exchange-12.0.xsd&lt;/A&gt;" units="mm" filename="Lista de Material Advance Steel.nwd" filepath="A:\01-Clientes\Inpasa\2023.115 - Usina Etanol - Sidrolândia\Áreas\_Auxiliar\Lista de Material Advance Steel"&amp;gt;&lt;BR /&gt;&amp;lt;selectionsets&amp;gt;&lt;BR /&gt;&amp;lt;selectionset name="Advance Steel" guid="48671e2e-028f-4fea-9d0e-2d3c9ec659da"&amp;gt;&lt;BR /&gt;&amp;lt;findspec mode="all" disjoint="0"&amp;gt;&lt;BR /&gt;&amp;lt;conditions&amp;gt;&lt;BR /&gt;&amp;lt;condition test="contains" flags="10"&amp;gt;&lt;BR /&gt;&amp;lt;property&amp;gt;&lt;BR /&gt;&amp;lt;name internal="LcOaSceneBaseClassUserName"&amp;gt;Type&amp;lt;/name&amp;gt;&lt;BR /&gt;&amp;lt;/property&amp;gt;&lt;BR /&gt;&amp;lt;value&amp;gt;&lt;BR /&gt;&amp;lt;data type="wstring"&amp;gt;AST&amp;lt;/data&amp;gt;&lt;BR /&gt;&amp;lt;/value&amp;gt;&lt;BR /&gt;&amp;lt;/condition&amp;gt;&lt;BR /&gt;&amp;lt;/conditions&amp;gt;&lt;BR /&gt;&amp;lt;locator&amp;gt;/&amp;lt;/locator&amp;gt;&lt;BR /&gt;&amp;lt;/findspec&amp;gt;&lt;BR /&gt;&amp;lt;/selectionset&amp;gt;&lt;BR /&gt;&amp;lt;/selectionsets&amp;gt;&lt;BR /&gt;&amp;lt;/exchange&amp;gt;&lt;BR /&gt;&lt;BR /&gt;.NET CODE:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;public static void AdicionarConjuntoSelecaoAdvanceSteel()&lt;BR /&gt;{&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;Document doc = Autodesk.Navisworks.Api.Application.ActiveDocument;&lt;/P&gt;&lt;P&gt;// Esta linha agora retorna corretamente uma ModelItemCollection&lt;BR /&gt;ModelItemCollection conjuntoSelecaoAdvanceSteel = create_search("LcOaSceneBaseClassUserName", "Type", "AST", "Advance Steel");&lt;/P&gt;&lt;P&gt;// Usa a ModelItemCollection diretamente sem casting&lt;BR /&gt;doc.CurrentSelection.Clear();&lt;BR /&gt;doc.CurrentSelection.AddRange(conjuntoSelecaoAdvanceSteel);&lt;BR /&gt;}&lt;BR /&gt;catch (Exception ex)&lt;BR /&gt;{&lt;BR /&gt;MessageBox.Show($"Erro ao criar o conjunto de seleção 'Advance Steel'.\nErro: {ex.Message}", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;public static ModelItemCollection create_search(string categoryDisplayName, string propertyDisplayName, string variantData, string searchSetName)&lt;BR /&gt;{&lt;BR /&gt;// Cria uma nova busca&lt;BR /&gt;Search search = new Search();&lt;/P&gt;&lt;P&gt;// Define a condição de busca para a propriedade com o nome de exibição fornecido&lt;BR /&gt;// e verifica se o valor de exibição é igual ao valor de 'variantData'&lt;BR /&gt;// Nota: A API padrão verifica igualdade; uma abordagem "contém" pode exigir uma implementação customizada&lt;BR /&gt;SearchCondition condition = SearchCondition&lt;BR /&gt;.HasPropertyByName(categoryDisplayName, propertyDisplayName)&lt;BR /&gt;.EqualValue(VariantData.FromDisplayString(variantData));&lt;/P&gt;&lt;P&gt;// Adiciona a condição de busca ao objeto de busca&lt;BR /&gt;search.SearchConditions.Add(condition);&lt;/P&gt;&lt;P&gt;// Configura a busca para selecionar todos os descendentes e o próprio item&lt;BR /&gt;search.Selection.SelectAll();&lt;BR /&gt;search.Locations = SearchLocations.DescendantsAndSelf;&lt;/P&gt;&lt;P&gt;// Executa a busca e cria um conjunto de seleção com os resultados&lt;BR /&gt;ModelItemCollection results = search.FindAll(Autodesk.Navisworks.Api.Application.ActiveDocument, false);&lt;/P&gt;&lt;P&gt;// Adiciona um novo conjunto de seleção ao documento com base nos resultados&lt;BR /&gt;// Isso é um pouco diferente do XML, onde o conjunto de seleção é definido dentro do arquivo&lt;BR /&gt;SelectionSet newSelectionSet = new SelectionSet(results);&lt;BR /&gt;newSelectionSet.DisplayName = searchSetName;&lt;BR /&gt;Autodesk.Navisworks.Api.Application.ActiveDocument.SelectionSets.AddCopy(newSelectionSet);&lt;/P&gt;&lt;P&gt;return results;&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Thu, 22 Feb 2024 11:46:49 GMT</pubDate>
    <dc:creator>eduardo_salvador02</dc:creator>
    <dc:date>2024-02-22T11:46:49Z</dc:date>
    <item>
      <title>Create a custom SelectionSet, which selects only Objects originating from Advance Steel</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/create-a-custom-selectionset-which-selects-only-objects/m-p/12575830#M726</link>
      <description>&lt;P&gt;Hello! Through the SOftware, we have the option of importing an XML file into the SelectionSet. I was trying to do the same through the API, but I did not find any method that allowed me to import this XML file through the .NET API.&lt;/P&gt;&lt;P&gt;I was developing the code below, I managed to create the SelectionSet, but it still does not return the selected items according to the category and property.&lt;/P&gt;&lt;P&gt;I'll leave my XML code below for review, and my .NET code that I was developing.&lt;/P&gt;&lt;P&gt;I'm waiting!&lt;BR /&gt;&lt;BR /&gt;XML:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;?xml version="1.0" encoding="UTF-8" ?&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;exchange xmlns:xsi="&lt;A href="http://www.w3.org/2001/XMLSchema-instance" target="_blank"&gt;http://www.w3.org/2001/XMLSchema-instance&lt;/A&gt;" xsi:noNamespaceSchemaLocation="&lt;A href="http://download.autodesk.com/us/navisworks/schemas/nw-exchange-12.0.xsd" target="_blank"&gt;http://download.autodesk.com/us/navisworks/schemas/nw-exchange-12.0.xsd&lt;/A&gt;" units="mm" filename="Lista de Material Advance Steel.nwd" filepath="A:\01-Clientes\Inpasa\2023.115 - Usina Etanol - Sidrolândia\Áreas\_Auxiliar\Lista de Material Advance Steel"&amp;gt;&lt;BR /&gt;&amp;lt;selectionsets&amp;gt;&lt;BR /&gt;&amp;lt;selectionset name="Advance Steel" guid="48671e2e-028f-4fea-9d0e-2d3c9ec659da"&amp;gt;&lt;BR /&gt;&amp;lt;findspec mode="all" disjoint="0"&amp;gt;&lt;BR /&gt;&amp;lt;conditions&amp;gt;&lt;BR /&gt;&amp;lt;condition test="contains" flags="10"&amp;gt;&lt;BR /&gt;&amp;lt;property&amp;gt;&lt;BR /&gt;&amp;lt;name internal="LcOaSceneBaseClassUserName"&amp;gt;Type&amp;lt;/name&amp;gt;&lt;BR /&gt;&amp;lt;/property&amp;gt;&lt;BR /&gt;&amp;lt;value&amp;gt;&lt;BR /&gt;&amp;lt;data type="wstring"&amp;gt;AST&amp;lt;/data&amp;gt;&lt;BR /&gt;&amp;lt;/value&amp;gt;&lt;BR /&gt;&amp;lt;/condition&amp;gt;&lt;BR /&gt;&amp;lt;/conditions&amp;gt;&lt;BR /&gt;&amp;lt;locator&amp;gt;/&amp;lt;/locator&amp;gt;&lt;BR /&gt;&amp;lt;/findspec&amp;gt;&lt;BR /&gt;&amp;lt;/selectionset&amp;gt;&lt;BR /&gt;&amp;lt;/selectionsets&amp;gt;&lt;BR /&gt;&amp;lt;/exchange&amp;gt;&lt;BR /&gt;&lt;BR /&gt;.NET CODE:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;public static void AdicionarConjuntoSelecaoAdvanceSteel()&lt;BR /&gt;{&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;Document doc = Autodesk.Navisworks.Api.Application.ActiveDocument;&lt;/P&gt;&lt;P&gt;// Esta linha agora retorna corretamente uma ModelItemCollection&lt;BR /&gt;ModelItemCollection conjuntoSelecaoAdvanceSteel = create_search("LcOaSceneBaseClassUserName", "Type", "AST", "Advance Steel");&lt;/P&gt;&lt;P&gt;// Usa a ModelItemCollection diretamente sem casting&lt;BR /&gt;doc.CurrentSelection.Clear();&lt;BR /&gt;doc.CurrentSelection.AddRange(conjuntoSelecaoAdvanceSteel);&lt;BR /&gt;}&lt;BR /&gt;catch (Exception ex)&lt;BR /&gt;{&lt;BR /&gt;MessageBox.Show($"Erro ao criar o conjunto de seleção 'Advance Steel'.\nErro: {ex.Message}", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;public static ModelItemCollection create_search(string categoryDisplayName, string propertyDisplayName, string variantData, string searchSetName)&lt;BR /&gt;{&lt;BR /&gt;// Cria uma nova busca&lt;BR /&gt;Search search = new Search();&lt;/P&gt;&lt;P&gt;// Define a condição de busca para a propriedade com o nome de exibição fornecido&lt;BR /&gt;// e verifica se o valor de exibição é igual ao valor de 'variantData'&lt;BR /&gt;// Nota: A API padrão verifica igualdade; uma abordagem "contém" pode exigir uma implementação customizada&lt;BR /&gt;SearchCondition condition = SearchCondition&lt;BR /&gt;.HasPropertyByName(categoryDisplayName, propertyDisplayName)&lt;BR /&gt;.EqualValue(VariantData.FromDisplayString(variantData));&lt;/P&gt;&lt;P&gt;// Adiciona a condição de busca ao objeto de busca&lt;BR /&gt;search.SearchConditions.Add(condition);&lt;/P&gt;&lt;P&gt;// Configura a busca para selecionar todos os descendentes e o próprio item&lt;BR /&gt;search.Selection.SelectAll();&lt;BR /&gt;search.Locations = SearchLocations.DescendantsAndSelf;&lt;/P&gt;&lt;P&gt;// Executa a busca e cria um conjunto de seleção com os resultados&lt;BR /&gt;ModelItemCollection results = search.FindAll(Autodesk.Navisworks.Api.Application.ActiveDocument, false);&lt;/P&gt;&lt;P&gt;// Adiciona um novo conjunto de seleção ao documento com base nos resultados&lt;BR /&gt;// Isso é um pouco diferente do XML, onde o conjunto de seleção é definido dentro do arquivo&lt;BR /&gt;SelectionSet newSelectionSet = new SelectionSet(results);&lt;BR /&gt;newSelectionSet.DisplayName = searchSetName;&lt;BR /&gt;Autodesk.Navisworks.Api.Application.ActiveDocument.SelectionSets.AddCopy(newSelectionSet);&lt;/P&gt;&lt;P&gt;return results;&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 11:46:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/create-a-custom-selectionset-which-selects-only-objects/m-p/12575830#M726</guid>
      <dc:creator>eduardo_salvador02</dc:creator>
      <dc:date>2024-02-22T11:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: Create a custom SelectionSet, which selects only Objects originating from Advance Steel</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/create-a-custom-selectionset-which-selects-only-objects/m-p/12576106#M727</link>
      <description>&lt;P&gt;Edit: Try this for your search condition:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;SearchCondition searchCond = SearchCondition.
	HasPropertyByDisplayName("Item", "Type").
	DisplayStringWildcard("AST*")
	.IgnoreStringValueCase();&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 15:33:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/create-a-custom-selectionset-which-selects-only-objects/m-p/12576106#M727</guid>
      <dc:creator>jabowabo</dc:creator>
      <dc:date>2024-02-22T15:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: Create a custom SelectionSet, which selects only Objects originating from Advance Steel</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/create-a-custom-selectionset-which-selects-only-objects/m-p/12590788#M728</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perfect! Works exactly how I need it! Thank you very much!&lt;/P&gt;&lt;P&gt;See if you can help me with this other question.&lt;/P&gt;&lt;P&gt;I need to edit the "Quick Property Definitions" properties, but I'm not having success. I found the following information regarding this global option on a forum:&lt;BR /&gt;&lt;BR /&gt;[7]interface.smart_tags: Quick Properties|smart_tags(|eFLAG_ORDERED)&lt;BR /&gt;[0]interface.smart_tags.enabled: Show Quick Properties =&amp;gt; Boolean:True&lt;BR /&gt;[1]interface.smart_tags.hide_category: Hide Category =&amp;gt; Boolean:False&lt;BR /&gt;[2]interface.smart_tags.definitions: Definitions|definitions(|eFLAG_ARRAY)&lt;BR /&gt;[0]interface.smart_tags.definitions.:&lt;BR /&gt;[0]interface.smart_tags.definitions..category: Category =&amp;gt; NamedConstant:LcOaNode(Item)&lt;BR /&gt;[1]interface.smart_tags.definitions..property: Property =&amp;gt; NamedConstant:LcOaSceneBaseUserName(Name)&lt;BR /&gt;[1]interface.smart_tags.definitions.:&lt;BR /&gt;[0]interface.smart_tags.definitions..category: Category =&amp;gt; NamedConstant:LcOaPropOverrideCat(Idigo)&lt;BR /&gt;[1]interface.smart_tags.definitions..property: Property =&amp;gt; NamedConstant:Fluid Code(Fluid Code)&lt;BR /&gt;[2]interface.smart_tags.definitions.:&lt;BR /&gt;[0]interface.smart_tags.definitions..category: Category =&amp;gt; NamedConstant:LcRevitData_Element(Element)&lt;BR /&gt;[1]interface.smart_tags.definitions..property: Property =&amp;gt; NamedConstant:lcldrevit_parameter_4911058(Pressure Drop)&lt;BR /&gt;[3]interface.smart_tags.definitions.:&lt;BR /&gt;[0]interface.smart_tags.definitions..category: Category =&amp;gt; NamedConstant:LcRevitData_Element(Element)&lt;BR /&gt;[1]interface.smart_tags.definitions..property: Property =&amp;gt; NamedConstant:lcldrevit_parameter_5085687(Pressure Drop)&lt;BR /&gt;[4]interface.smart_tags.definitions.:&lt;BR /&gt;[0]interface.smart_tags.definitions..category: Category =&amp;gt; NamedConstant:LcOaPropOverrideCat(Idigo)&lt;BR /&gt;[1]interface.smart_tags.definitions..property: Property =&amp;gt; NamedConstant:Zone(Zone)&lt;BR /&gt;[5]interface.smart_tags.definitions.:&lt;BR /&gt;[0]interface.smart_tags.definitions..category: Category =&amp;gt; NamedConstant:PDMS(PDMS)&lt;BR /&gt;[1]interface.smart_tags.definitions..property: Property =&amp;gt; NamedConstant:lcldrvm_prop_:clap(:CLAP)&lt;BR /&gt;[6]interface.smart_tags.definitions.:&lt;BR /&gt;[0]interface.smart_tags.definitions..category: Category =&amp;gt; NamedConstant:LcOaPropOverrideCat(Idigo)&lt;BR /&gt;[1]interface.smart_tags.definitions..property: Property =&amp;gt; NamedConstant:Pipe NPS(Pipe NPS)&lt;BR /&gt;[7]interface.smart_tags.definitions.:&lt;BR /&gt;[0]interface.smart_tags.definitions..category: Category =&amp;gt; NamedConstant:LcOaPropOverrideCat(Idigo)&lt;BR /&gt;[1]interface.smart_tags.definitions..property: Property =&amp;gt; NamedConstant:Pipe Total OD(Pipe Total OD)&lt;BR /&gt;[8]interface.smart_tags.definitions.:&lt;BR /&gt;[0]interface.smart_tags.definitions..category: Category =&amp;gt; NamedConstant:LcOaPropOverrideCat(Idigo)&lt;BR /&gt;[1]interface.smart_tags.definitions..property: Property =&amp;gt; NamedConstant:Pipeline(Pipeline)&lt;BR /&gt;[9]interface.smart_tags.definitions.:&lt;BR /&gt;[0]interface.smart_tags.definitions..category: Category =&amp;gt; NamedConstant:LcOaPropOverrideCat(Idigo)&lt;BR /&gt;[1]interface.smart_tags.definitions..property: Property =&amp;gt; NamedConstant:Pipe Length(Pipe Length)&lt;BR /&gt;[10]interface.smart_tags.definitions.:&lt;BR /&gt;[0]interface.smart_tags.definitions..category: Category =&amp;gt; NamedConstant:LineStyle(LineStyle)&lt;BR /&gt;[1]interface.smart_tags.definitions..property: Property =&amp;gt; NamedConstant:GraphicsStyleType(GraphicsStyleType)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;However, I don't know how to change these values ​​to the ones I need, through Navisworks, I also use an XML file that I just import, and it already changes the settings.&lt;/P&gt;&lt;P&gt;XML is linked in the post.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Feb 2024 13:40:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/create-a-custom-selectionset-which-selects-only-objects/m-p/12590788#M728</guid>
      <dc:creator>eduardo_salvador02</dc:creator>
      <dc:date>2024-02-29T13:40:03Z</dc:date>
    </item>
  </channel>
</rss>

