<?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 map xml to user parameters in ilogic or vb in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/map-xml-to-user-parameters-in-ilogic-or-vb/m-p/7554653#M77020</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying parse and import parameters from an .xml file into inventor. I've attached the file for reference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The file I've attached is an output from a home-grown design program for one of the products we use. It spits out this file to be read by our ERP system downstream of Engineering. I would also like to use it to populate my model with parameters so the drawing is generated automatically.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, the material_thickness nodes correspond to steel plate thicknesses, and the lenght/width correspond to steel plate rectangular dimensions. There are also bolt diameters and other parameters I would like to read.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know there is an out of the box import/export xml parameters, but from what I understand the xml has to be formatted a specific way. I would like to map this existing schema to user parameters in my model.&amp;nbsp;If someone could send me an ilogic or vb code snippet that would be great.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
    <pubDate>Sat, 18 Nov 2017 03:13:08 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-11-18T03:13:08Z</dc:date>
    <item>
      <title>map xml to user parameters in ilogic or vb</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/map-xml-to-user-parameters-in-ilogic-or-vb/m-p/7554653#M77020</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying parse and import parameters from an .xml file into inventor. I've attached the file for reference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The file I've attached is an output from a home-grown design program for one of the products we use. It spits out this file to be read by our ERP system downstream of Engineering. I would also like to use it to populate my model with parameters so the drawing is generated automatically.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, the material_thickness nodes correspond to steel plate thicknesses, and the lenght/width correspond to steel plate rectangular dimensions. There are also bolt diameters and other parameters I would like to read.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know there is an out of the box import/export xml parameters, but from what I understand the xml has to be formatted a specific way. I would like to map this existing schema to user parameters in my model.&amp;nbsp;If someone could send me an ilogic or vb code snippet that would be great.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Sat, 18 Nov 2017 03:13:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/map-xml-to-user-parameters-in-ilogic-or-vb/m-p/7554653#M77020</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-18T03:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: map xml to user parameters in ilogic or vb</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/map-xml-to-user-parameters-in-ilogic-or-vb/m-p/7557086#M77040</link>
      <description>&lt;P&gt;Matt,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do a similar thing (import to inventor from xml)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My xml format may be slightly different, but here is some of the code that i use.&lt;/P&gt;&lt;P&gt;I use VBA to do this - example below.&lt;/P&gt;&lt;P&gt;I hope you can figure out what you need to change, based on this example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dean.&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'I have a reference to Microsoft XML v3.0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;xmlfile = "C:\xml.xml" 'Path to xml file&lt;/P&gt;&lt;P&gt;Set objXML = New MSXML2.DOMDocument&lt;/P&gt;&lt;P&gt;objXML.Load xmlfile&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'For a normal node&lt;/P&gt;&lt;P&gt;Set xmlElem = objXML.selectSingleNode("//NodeName")&lt;BR /&gt;If Not xmlElem Is Nothing Then&lt;BR /&gt;oNodeName = xmlElem.Text&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'For a node with children&lt;/P&gt;&lt;P&gt;Set xmlElem = objXML.selectNodes("//NodeNamewithchildren")&lt;BR /&gt;If Not xmlElem Is Nothing Then&lt;BR /&gt;oNodeNamewithchildren = xmlElem.ChildNodes.Item(0).Text 'index for child node&lt;BR /&gt;End IF&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;'To apply the xml node value to a User Paramater&lt;/P&gt;&lt;P&gt;Dim oFileLocations As FileLocations&lt;BR /&gt;Set oFileLocations = ThisApplication.FileLocations&lt;/P&gt;&lt;P&gt;Dim oPartDoc As PartDocument&lt;BR /&gt;Set oPartDoc = ThisApplication.Documents.Open(oFileLocations.Workspace &amp;amp; "/Part.ipt")&lt;/P&gt;&lt;P&gt;Dim oPartCompDef As PartComponentDefinition&lt;BR /&gt;Set oPartCompDef = oPartDoc.ComponentDefinition&lt;/P&gt;&lt;P&gt;Dim oParams As UserParameters&lt;BR /&gt;Set oParams = oPartCompDef.Parameters.UserParameters&lt;/P&gt;&lt;P&gt;oParams.Item("ParameterName").Expression = oNodeName&lt;/P&gt;&lt;P&gt;oParams.Item("ParameterName").Expression = oNodeNamewithchildren&lt;/P&gt;&lt;P&gt;oPartDoc.Save2 (True)&lt;BR /&gt;oPartDoc.Close&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2017 02:16:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/map-xml-to-user-parameters-in-ilogic-or-vb/m-p/7557086#M77040</guid>
      <dc:creator>dean.morrison</dc:creator>
      <dc:date>2017-11-20T02:16:10Z</dc:date>
    </item>
  </channel>
</rss>

