<?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: iLogic to purge styles in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/11826453#M68733</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12723095"&gt;@ppolcynBNVFN&lt;/a&gt;.&amp;nbsp; I have attached a couple text files for you to try out as external iLogic rules.&amp;nbsp; I am using two different external iLogic rules, because I usually know what type of document I am working with, and model type files (parts &amp;amp; assemblies) have different types of things that need to be purged &amp;amp;/or updated than drawings, so I just call the one that is appropriate for the document type I am working with.&amp;nbsp; Then I have other rules for actually creating or setting new standards or styles, and updating pre-existing objects to the new standards.&lt;/P&gt;</description>
    <pubDate>Thu, 16 Mar 2023 16:28:48 GMT</pubDate>
    <dc:creator>WCrihfield</dc:creator>
    <dc:date>2023-03-16T16:28:48Z</dc:date>
    <item>
      <title>iLogic to purge styles</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9195759#M68718</link>
      <description>&lt;P&gt;Hello fellow Inventor users, &lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was looking for a way to purge the styles of all the files I work with.&lt;/P&gt;&lt;P&gt;I couldn't find a finished code, so I started tinkering.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I came up with the following:&lt;/P&gt;&lt;PRE&gt;Dim oThisDoc As Document
oThisDoc = ThisDoc.Document

DocType = oThisDoc.DocumentType

Select Case DocType.ToString

'---File is a Drawing---

	Case "kDrawingDocumentObject"

		Dim oDoc As DrawingDocument
		oDoc = ThisDrawing.Document
		Dim oStyles As Styles
		oStyles = oDoc.StylesManager.Styles

		' Info: StyleLocation
		' 51201	=	both (library and local)
		' 51202	=	local
		' 51203	=	library

		DelStyles = True
		DelLoops = 0

		While DelStyles = True And DelLoops &amp;lt; 100 
			DelCounter = 0
			For Each oStyle In oStyles
				' Only delete unused styles saved in 'local' or 'both'
				If oStyle.StyleLocation.ToString &amp;lt;&amp;gt; "51203" And Not oStyle.InUse Then
					oStyle.Delete
					DelCounter += 1
				End If
			Next
			If DelCounter = 0 Then DelStyles = False
			DelLoops += 1
		End While

' ---File is a part or assembly---

	Case "kPartDocumentObject", "kAssemblyDocumentObject"

		Dim oStylesMan As StylesManager
		oStylesMan = ThisApplication.StylesManager
		Dim oDoc As Document
		oDoc = ThisApplication.ActiveDocument
		Dim oAsset As Asset

		' Info: AssetType
		'	99073	 = 	appearances
		'	99074	 = 	materials

		' Materials first
		For Each oAsset In oDoc.Assets
			If oAsset.AssetType = 99074 And Not oAsset.IsUsed Then
				oAsset.Delete
			End If
		Next

		' Then appearances
		For Each oAsset In oDoc.Assets
			If oAsset.AssetType = 99073 And Not oAsset.IsUsed Then
				oAsset.Delete
			End If
		Next

End Select&lt;/PRE&gt;&lt;P&gt;The code works flawlessly for drawings, but in parts or assemblies I always get an error, saying the active file is not a drawing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone figure out my mistake?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance &lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 12:32:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9195759#M68718</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-12-11T12:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to purge styles</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9196200#M68719</link>
      <description>&lt;P&gt;why not use the Task scheduler to purge files?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 15:11:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9196200#M68719</guid>
      <dc:creator>HermJan.Otterman</dc:creator>
      <dc:date>2019-12-11T15:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to purge styles</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9197888#M68720</link>
      <description>&lt;P&gt;Because we work with many different styles simultaneously.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Task scheduler would have to go over our data over and over again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By using an iLogic attached to an Event Trigger we grab the problem by its root.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 07:02:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9197888#M68720</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-12-12T07:02:36Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to purge styles</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9199871#M68721</link>
      <description>&lt;P&gt;I did not test this iLogic rule very good but you can give it a try.&lt;/P&gt;&lt;PRE&gt;Dim doc As Document = ThisApplication.ActiveDocument
If (doc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject) Then
    Dim dDoc As DrawingDocument = doc
    Dim styles As Styles = dDoc.StylesManager.Styles
    For Each styl As Style In styles
        If (styl.InUse = False And styl.StyleLocation &amp;lt;&amp;gt; StyleLocationEnum.kLibraryStyleLocation) Then
            styl.Delete()
        End If
    Next
ElseIf (doc.DocumentType = DocumentTypeEnum.kPartDocumentObject Or doc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject) Then
    For Each asset As Asset In doc.Assets
        If (asset.IsUsed = False) Then
            If (asset.AssetType = AssetTypeEnum.kAssetTypeMaterial Or
                    asset.AssetType = AssetTypeEnum.kAssetTypeAppearance) Then
                asset.Delete()
            End If
        End If
    Next
End If&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Dec 2019 22:56:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9199871#M68721</guid>
      <dc:creator>JelteDeJong</dc:creator>
      <dc:date>2019-12-12T22:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to purge styles</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9203861#M68722</link>
      <description>&lt;P&gt;It seems to work fine in drawings, but in parts and in assemblies it doesn't do anything.&lt;/P&gt;&lt;P&gt;I tried to find the problem, but I couldn't.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 07:05:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9203861#M68722</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-12-16T07:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to purge styles</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9204501#M68723</link>
      <description>&lt;P&gt;This is a very similar code, but is a little more sepperated out.&amp;nbsp; You can give it a try, though to see if it works for you.&lt;/P&gt;&lt;PRE&gt;Dim oDoc As Document = ThisApplication.ActiveDocument
If oDoc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
	For Each oStyle As Style In ThisDrawing.Document.StylesManager.Styles
		If oStyle.StyleLocation &amp;lt;&amp;gt; StyleLocationEnum.kLibraryStyleLocation Then
			If oStyle.InUse = False Then
				oStyle.Delete
			End If
		End If
	Next
ElseIf oDocType = DocumentTypeEnum.kPartDocumentObject Then
	Dim oPdoc As PartDocument = ThisApplication.ActiveDocument
	For Each oAsset As Asset In oPdoc.Assets
		If oAsset.IsUsed = False Then
			If oAsset.AssetType = AssetTypeEnum.kAssetTypeMaterial Then
				oAsset.Delete
			ElseIf oAsset.AssetType = AssetTypeEnum.kAssetTypeAppearance Then
				oAsset.Delete
			End If
		End If
	Next
ElseIf oDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
	For Each oAsset As Asset In ThisAssembly.Document.Assets
		If oAsset.IsUsed = False Then
			If oAsset.AssetType = AssetTypeEnum.kAssetTypeMaterial Then
				oAsset.Delete
			ElseIf oAsset.AssetType = AssetTypeEnum.kAssetTypeAppearance Then
				oAsset.Delete
			End If
		End If
	Next
End If&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Dec 2019 13:55:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9204501#M68723</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2019-12-16T13:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to purge styles</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9204617#M68724</link>
      <description>&lt;P&gt;Also, if any of your models and/or solid bodies are using a different appearance than the default one for the selected material, you may need to delete the appearances before you delete the materials (Part Documents), because often the appearance is a sub-asset of the Material asset.&amp;nbsp; So you won't be able to delete the material, even if you aren't using it, if its associated appearance is being used.&amp;nbsp; See the following code.&lt;/P&gt;&lt;PRE&gt;Dim oDoc As Document = ThisApplication.ActiveDocument
If oDoc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
	For Each oStyle As Style In ThisDrawing.Document.StylesManager.Styles
		If oStyle.StyleLocation &amp;lt;&amp;gt; StyleLocationEnum.kLibraryStyleLocation Then
			If oStyle.InUse = False Then
				oStyle.Delete
			End If
		End If
	Next
ElseIf oDocType = DocumentTypeEnum.kPartDocumentObject Then
	Dim oPdoc As PartDocument = ThisApplication.ActiveDocument
	For Each oAppAsset As Asset In oPdoc.AppearanceAssets
		If oAppAsset.IsReadOnly = False AndAlso
			oAppAsset.IsUsed = False Then
			oAppAsset.Delete
		End If
	Next
	For Each oMatAsset As MaterialAsset In oPdoc.MaterialAssets
		If oMatAsset.AppearanceAsset.IsUsed = False Then
			If oMatAsset.AppearanceAsset.IsReadOnly = False AndAlso
			oMatAsset.AppearanceAsset.IsUsed = False Then
				oMatAsset.AppearanceAsset.Delete
			End If
			If oMatAsset.IsReadOnly = False AndAlso
				oMatAsset.IsUsed = False Then
				oMatAsset.Delete
			End If
		End If
	Next
ElseIf oDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
	For Each oAppAsset As Asset In ThisAssembly.Document.AppearanceAssets
		If oAppAsset.IsReadOnly = False AndAlso
			oAppAsset.IsUsed = False Then
			oAppAsset.Delete
		End If
	Next
	For Each oMatAsset As MaterialAsset In ThisAssembly.Document.MaterialAssets
		If oMatAsset.AppearanceAsset.IsUsed = False Then
			If oMatAsset.AppearanceAsset.IsReadOnly = False AndAlso
			oMatAsset.AppearanceAsset.IsUsed = False Then
				oMatAsset.AppearanceAsset.Delete
			End If
			If oMatAsset.IsReadOnly = False AndAlso
				oMatAsset.IsUsed = False Then
				oMatAsset.Delete
			End If
		End If
	Next
End If&lt;/PRE&gt;&lt;P&gt;If the previous code doesn't work, try this one.&lt;/P&gt;&lt;P&gt;Let me know if this works for you.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 14:28:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9204617#M68724</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2019-12-16T14:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to purge styles</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9204682#M68725</link>
      <description>&lt;P&gt;I was a little too quick to repost that last time. If forgot to delete the redundant If IsUsed and End If lines.&lt;/P&gt;&lt;P&gt;Here's the corrected version.&lt;/P&gt;&lt;PRE&gt;Dim oDoc As Document = ThisApplication.ActiveDocument
If oDoc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
	For Each oStyle As Style In ThisDrawing.Document.StylesManager.Styles
		If oStyle.StyleLocation &amp;lt;&amp;gt; StyleLocationEnum.kLibraryStyleLocation Then
			If oStyle.InUse = False Then
				oStyle.Delete
			End If
		End If
	Next
ElseIf oDocType = DocumentTypeEnum.kPartDocumentObject Then
	Dim oPdoc As PartDocument = ThisApplication.ActiveDocument
	For Each oAppAsset As Asset In oPdoc.AppearanceAssets
		If oAppAsset.IsReadOnly = False AndAlso
		oAppAsset.IsUsed = False Then
			oAppAsset.Delete
		End If
	Next
	For Each oMatAsset As MaterialAsset In oPdoc.MaterialAssets
		If oMatAsset.AppearanceAsset.IsReadOnly = False AndAlso
		oMatAsset.AppearanceAsset.IsUsed = False Then
			oMatAsset.AppearanceAsset.Delete
		End If
		If oMatAsset.IsReadOnly = False AndAlso
			oMatAsset.IsUsed = False Then
			oMatAsset.Delete
		End If
	Next
ElseIf oDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
	For Each oAppAsset As Asset In ThisAssembly.Document.AppearanceAssets
		If oAppAsset.IsReadOnly = False AndAlso
		oAppAsset.IsUsed = False Then
			oAppAsset.Delete
		End If
	Next
	For Each oMatAsset As MaterialAsset In ThisAssembly.Document.MaterialAssets
		If oMatAsset.AppearanceAsset.IsReadOnly = False AndAlso
		oMatAsset.AppearanceAsset.IsUsed = False Then
			oMatAsset.AppearanceAsset.Delete
		End If
		If oMatAsset.IsReadOnly = False AndAlso
		oMatAsset.IsUsed = False Then
			oMatAsset.Delete
		End If
	Next
End If&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Dec 2019 14:53:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9204682#M68725</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2019-12-16T14:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to purge styles</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9206239#M68726</link>
      <description>&lt;P&gt;I did some more testing and I finally could find the problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For some reason materials are only purged properly, after executing the code twice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here the final code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim doc As Document = ThisApplication.ActiveDocument
If (doc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject) Then
    Dim dDoc As DrawingDocument = doc
    Dim styles As Styles = dDoc.StylesManager.Styles
    For Each styl As Style In styles
        If (styl.InUse = False And styl.StyleLocation &amp;lt;&amp;gt; StyleLocationEnum.kLibraryStyleLocation) Then
            styl.Delete()
        End If
    Next
ElseIf (doc.DocumentType = DocumentTypeEnum.kPartDocumentObject Or doc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject) Then
    For Each asset As Asset In doc.Assets
        If (asset.IsUsed = False) Then
            If (asset.AssetType = AssetTypeEnum.kAssetTypeMaterial Or
                    asset.AssetType = AssetTypeEnum.kAssetTypeAppearance) Then
                asset.Delete()
            End If
        End If
    Next
End If

'---Execute twice---

If (doc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject) Then
    Dim dDoc As DrawingDocument = doc
    Dim styles As Styles = dDoc.StylesManager.Styles
    For Each styl As Style In styles
        If (styl.InUse = False And styl.StyleLocation &amp;lt;&amp;gt; StyleLocationEnum.kLibraryStyleLocation) Then
            styl.Delete()
        End If
    Next
ElseIf (doc.DocumentType = DocumentTypeEnum.kPartDocumentObject Or doc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject) Then
    For Each asset As Asset In doc.Assets
        If (asset.IsUsed = False) Then
            If (asset.AssetType = AssetTypeEnum.kAssetTypeMaterial Or
                    asset.AssetType = AssetTypeEnum.kAssetTypeAppearance) Then
                asset.Delete()
            End If
        End If
    Next
End If&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Dec 2019 07:08:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9206239#M68726</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-12-17T07:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to purge styles</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9207105#M68727</link>
      <description>&lt;P&gt;You could try the plan I explained earlier and try looping through and deleting all the Appearances first.&lt;/P&gt;&lt;P&gt;Then loop through to delete all the Materials secondly.&amp;nbsp; Or vise-versa.&amp;nbsp; Maybe doing this will eliminate having to run the whole rule twice.&amp;nbsp; It's worth a try.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2019 14:25:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9207105#M68727</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2019-12-17T14:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to purge styles</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9586159#M68728</link>
      <description>&lt;P&gt;you noticed something that I thought I was going crazy in noticing.&lt;BR /&gt;&lt;BR /&gt;hope the Developers can fix this.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2020 21:17:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9586159#M68728</guid>
      <dc:creator>DeerSpotter</dc:creator>
      <dc:date>2020-06-17T21:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to purge styles</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9587201#M68729</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How about a quick &amp;amp; simple little VBA Macro button to click, that will do all of this using Inventor's built-in tool, just for purging unused styles.&lt;/P&gt;&lt;P&gt;Insert this simple VBA code into a Module under your VBA Editor's ApplicationProject (gets stored in the default application project .ivb file, so it will always be available).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub PurgeStyles()
    Dim oCDs As ControlDefinitions
    Set oCDs = ThisApplication.CommandManager.ControlDefinitions
    Dim oPurgeStyles As ControlDefinition
    Set oPurgeStyles = oCDs.Item("PurgeStylesCmd")
    Call oPurgeStyles.Execute2(False)
    Call AppActivate(ThisApplication.Caption)
    Call SendKeys("{TAB}{TAB}{TAB}{TAB}{TAB}{ }{TAB}{TAB}{TAB}{ENTER}{ENTER}", True)
    Call ThisApplication.UserInterfaceManager.DoEvents
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Granted, you sometimes have to click the button more than once to fully get rid of all purge-able stuff, but it works really fast this way.&lt;/P&gt;&lt;P&gt;What this does is activate the built-in Purge tool (located on the Manage tab / Styles and Standards panel), then uses the Tab keyboard key 5 times to navigate to the "Yes to All" button, then uses the Space key to click that button, then uses the Tab key 3 more times to get to the "OK" button, then uses the Enter key once (which clicks the OK button), then a second time (which says OK to the possible warning message that often pops-up warning you if the styles you're deleting have been modified locally, and you may loose those modifications).&amp;nbsp; But if you aren't using those styles, you don't need them, and that's why we're Purging them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;BR /&gt;If this solves your problem, or answers your questions, please click 'Accept As Solution".&lt;BR /&gt;Or, if this helps you reach your goal, please click 'LIKES" &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, if you're interested, here are a few of the 'Ideas' I'd like to get implemented.&lt;BR /&gt;If you agree with any of them, please vote for them.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Add more capabilities to the 'Customize' dialog box (exe. Add Tab &amp;amp; Add Panel) &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/add-more-capabilities-to-the-customize-dialog-box-exe-add-tab/idi-p/9371747/" target="_blank" rel="noopener"&gt;Click Here &lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;Constrain &amp;amp; Dimension Images In Assembly Sketches &amp;amp; Drawing Sketches (TitleBlocks &amp;amp; SketchedSymbols) &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/we-need-the-ability-to-fully-constrain-amp-dimension-images/idi-p/9299088/" target=" Blank"&gt;Click Here &lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;Save Section View Status In DesignViewRepresentation (So It Can Be Used In The Drawing) &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/save-section-view-status-in-designviewrepresentation-so-is/idi-p/9270962/" target=" Blank"&gt;Click Here &lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;Add SolidBodies Folder In iLogic Rule Editor Model Tab &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/ilogic-rule-editor-gt-model-tab-add-a-solid-bodies-folder-for/idi-p/9270898/" target=" Blank"&gt;Click Here &lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;Convert All Views To Raster Before Autosave Stores To 'OldVersions' Folder &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/drawings-in-oldversions-set-all-views-to-raster-before-autosave/idi-p/9185521/" target=" Blank"&gt;Click Here &lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;SetDesignViewRepresentation - Fix limitations for DrawingView of a Part &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/setdesignviewrepresentation-fix-limitations-for-drawingview-of-a/idi-p/9369920/" target=" Blank"&gt;Click Here &lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;Create DocumentSubTypeEnum &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/create-enum-for-documentsubtype-amp-or-document-subtype/idi-p/9402300/" target=" Blank"&gt;Click Here &lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;Add kRevisionTag or kDrawingRevisionTag to ObjectTypeEnum &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/add-krevisiontag-or-kdrawingrevisiontag-to-objecttypeenum-ilogic/idi-p/9507606/" target=" Blank"&gt;Click Here &lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;A href="http://help.autodesk.com/view/INVNTOR/2020/ENU/" target="_blank"&gt;Inventor 2020 Help &lt;/A&gt;| &lt;A href="https://forums.autodesk.com/t5/inventor-forum/bd-p/78/" target="_blank"&gt;Inventor Forum &lt;/A&gt;| &lt;A href="https://forums.autodesk.com/t5/inventor-customization/bd-p/120/" target="_blank"&gt;Inventor Customization Forum &lt;/A&gt;| &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/idb-p/v1232/" target="_blank"&gt;Inventor Ideas Forum &lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2020 12:17:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/9587201#M68729</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-06-18T12:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to purge styles</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/11712945#M68730</link>
      <description>&lt;P&gt;I went with your suggestion to initially delete the unused AppearanceAssets and afterwards the MaterialAssets. But had to run the code twice too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But you were right with your suggestion to try vice-versa. The solution is to first delete unused MaterialAssets and afterwards the unused AppearanceAssets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&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;LI-CODE lang="visual-basic"&gt;Private Sub CleanUnsuedStyles3D()
    Dim oAssets As Assets = ThisDoc.Document.Assets

    ' Clean Material Assets first
    For Each oAsset As Asset In oAssets
        Try
            If (oAsset.AssetType = AssetTypeEnum.kAssetTypeMaterial And oAsset.IsReadOnly = False And oAsset.IsUsed = False) Then
                Logger.Info(iLogicVb.RuleName &amp;amp; " | " &amp;amp; ThisDoc.FileName(True) &amp;amp; " | Removed unused Material Asset: " &amp;amp; oAsset.Name)
                oAsset.Delete()
            End If
        Catch
            Logger.Warn(iLogicVb.RuleName &amp;amp; " | " &amp;amp; ThisDoc.FileName(True) &amp;amp; " | Error removing unused Material Asset.")
        End Try
    Next

    ' Clean Appearance Assets second
    For Each oAsset As Asset In oAssets
        Try
            If (oAsset.AssetType = AssetTypeEnum.kAssetTypeAppearance And oAsset.IsReadOnly = False And oAsset.IsUsed = False) Then
                Logger.Info(iLogicVb.RuleName &amp;amp; " | " &amp;amp; ThisDoc.FileName(True) &amp;amp; " | Removed unused Appearance Asset: " &amp;amp; oAsset.Name)
                oAsset.Delete()
            End If
        Catch
            Logger.Warn(iLogicVb.RuleName &amp;amp; " | " &amp;amp; ThisDoc.FileName(True) &amp;amp; " | Error removing unused Appearance Asset.")
        End Try
    Next
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Jan 2023 16:54:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/11712945#M68730</guid>
      <dc:creator>jbetz42</dc:creator>
      <dc:date>2023-01-29T16:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to purge styles</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/11715505#M68731</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11205334"&gt;@jbetz42&lt;/a&gt;.&amp;nbsp; Glad to see that you were able to derive a solution that works for you from our suggestions.&amp;nbsp; What I did later on, within my own set of solutions, is created a separate Function routine for both purging unused resources, but also updating the ones being used.&amp;nbsp; I set this function up to return a Boolean value...True if anything was changed by the function, and False if the function either had no effect, or encountered any sort of error.&amp;nbsp; Then within that Function, a Boolean variable is created and used to track if any changes are made, then that variable's value is 'returned' at the end.&amp;nbsp; Then within the 'calling' routine (the routine that calls the function to run) I set it up within a 'Do Loop', so that as long as it returns True, it will continue to run it again, until it returns False, indicating that it is having no further effect.&amp;nbsp; This takes care of the scenario of sometimes needing multiple runs to clear any sub-styles or styles that were dependent on the ones that were just deleted, which can sometimes go multiple layers deep in rare complex scenarios.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 12:50:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/11715505#M68731</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-01-30T12:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to purge styles</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/11826386#M68732</link>
      <description>&lt;P&gt;That sounds very promising. Could you make that code available?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 15:58:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/11826386#M68732</guid>
      <dc:creator>ppolcynBNVFN</dc:creator>
      <dc:date>2023-03-16T15:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to purge styles</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/11826453#M68733</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12723095"&gt;@ppolcynBNVFN&lt;/a&gt;.&amp;nbsp; I have attached a couple text files for you to try out as external iLogic rules.&amp;nbsp; I am using two different external iLogic rules, because I usually know what type of document I am working with, and model type files (parts &amp;amp; assemblies) have different types of things that need to be purged &amp;amp;/or updated than drawings, so I just call the one that is appropriate for the document type I am working with.&amp;nbsp; Then I have other rules for actually creating or setting new standards or styles, and updating pre-existing objects to the new standards.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 16:28:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-purge-styles/m-p/11826453#M68733</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-03-16T16:28:48Z</dc:date>
    </item>
  </channel>
</rss>

