<?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 Betreff: How to update document assets from library? in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-update-document-assets-from-library/m-p/10095550#M121165</link>
    <description>&lt;P&gt;Added:&lt;/P&gt;&lt;P&gt;This question also relates to AppearanceAsset. Same Problem!&lt;/P&gt;&lt;P&gt;I can update the one active material by&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ThisDocument.ComponentDefinition.Material.UpdateFromGlobal&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but this doesn't update the materials appearance.&lt;/P&gt;</description>
    <pubDate>Fri, 19 Feb 2021 09:04:19 GMT</pubDate>
    <dc:creator>C-Hoppen</dc:creator>
    <dc:date>2021-02-19T09:04:19Z</dc:date>
    <item>
      <title>How to update document assets from library?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-update-document-assets-from-library/m-p/10093953#M121142</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;this always crashes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Inventor.PartDocument partDocument = (Inventor.PartDocument)refDocument;
List&amp;lt;Inventor.Asset&amp;gt; updateList = new List&amp;lt;Inventor.Asset&amp;gt;();
foreach (Inventor.MaterialAsset materialAsset in partDocument.MaterialAssets)
{
	try
	{
		updateList.Add(oApp.ActiveMaterialLibrary.MaterialAssets[materialAsset.DisplayName]);
	}
	catch { }
}

foreach (Inventor.Asset asset in updateList)
	try
	{
		asset.CopyTo(partDocument, ReplaceExisting: true); // &amp;lt;---- THROWS AN EXCEPTION
	}
	catch { }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;What could be the reason for this problem?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 18:15:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-update-document-assets-from-library/m-p/10093953#M121142</guid>
      <dc:creator>C-Hoppen</dc:creator>
      <dc:date>2021-02-18T18:15:14Z</dc:date>
    </item>
    <item>
      <title>Betreff: How to update document assets from library?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-update-document-assets-from-library/m-p/10095459#M121160</link>
      <description>&lt;P&gt;I tried to do it with VBA but same problem.&lt;/P&gt;&lt;P&gt;I noticed that there is a difference in the signature of CopyTo between VBA and the API doc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;API&lt;/P&gt;&lt;P&gt;ReplaceExisting:&amp;nbsp;Optional input Boolean that specifies whether replace the existing asset if an asset of the same name exists.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;VBA&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CopyTo.jpg" style="width: 857px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/882914i7EED0634CE46AEC1/image-size/large?v=v2&amp;amp;px=999" role="button" title="CopyTo.jpg" alt="CopyTo.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So I tried this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Dim docMaterial As MaterialAsset
Set docMaterial = ThisDocument.ActiveMaterial

Dim libMaterial As MaterialAsset
Set libMaterial = ThisApplication.ActiveMaterialLibrary.MaterialAssets.Item(docMaterial.DisplayName)

Set docMaterial = libMaterial.CopyTo(ThisDocument.MaterialAssets, docMaterial)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Dim docMaterial As asset // &amp;lt;-- why does this always turn to lower case?
Set docMaterial = ThisDocument.ActiveMaterial

Dim libMaterial As asset
Set libMaterial = ThisApplication.ActiveMaterialLibrary.MaterialAssets.Item(docMaterial.DisplayName)

Set docMaterial = libMaterial.CopyTo(ThisDocument.Assets, docMaterial)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;and this (as desribed in the API docs)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Set docMaterial = libMaterial.CopyTo(ThisDocument.Assets, True)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;and it always chrashes at CopyTo.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I update a existing MaterialAsset from a library?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Christoph&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 08:29:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-update-document-assets-from-library/m-p/10095459#M121160</guid>
      <dc:creator>C-Hoppen</dc:creator>
      <dc:date>2021-02-19T08:29:55Z</dc:date>
    </item>
    <item>
      <title>Betreff: How to update document assets from library?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-update-document-assets-from-library/m-p/10095550#M121165</link>
      <description>&lt;P&gt;Added:&lt;/P&gt;&lt;P&gt;This question also relates to AppearanceAsset. Same Problem!&lt;/P&gt;&lt;P&gt;I can update the one active material by&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ThisDocument.ComponentDefinition.Material.UpdateFromGlobal&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but this doesn't update the materials appearance.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 09:04:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-update-document-assets-from-library/m-p/10095550#M121165</guid>
      <dc:creator>C-Hoppen</dc:creator>
      <dc:date>2021-02-19T09:04:19Z</dc:date>
    </item>
    <item>
      <title>Betreff: How to update document assets from library?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-update-document-assets-from-library/m-p/10138709#M121844</link>
      <description>&lt;P&gt;Is there no solution? I need to update Material &lt;STRONG&gt;and&lt;/STRONG&gt; Appearance Assets?&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Christoph&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 13:29:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-update-document-assets-from-library/m-p/10138709#M121844</guid>
      <dc:creator>c_hoppen</dc:creator>
      <dc:date>2021-03-08T13:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to update document assets from library?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-update-document-assets-from-library/m-p/12675052#M165650</link>
      <description>&lt;P&gt;I'm running into this issue also. Did you ever find a solution?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Mar 2024 19:52:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-update-document-assets-from-library/m-p/12675052#M165650</guid>
      <dc:creator>mfoster9TD82</dc:creator>
      <dc:date>2024-03-29T19:52:51Z</dc:date>
    </item>
  </channel>
</rss>

