Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Preston_Reed
in reply to: WCrihfield

Hey @WCrihfield , I appreciate you, this helped quite a bit.  It is working now.  I do have a follow up question on ReadOnly or Content Center parts.  We are new to automation and iLogic, just now trying to automate our Cad processes.  We don't have Vault yet, so we have a purchased drive with our parts.  The purchased drive is a mess from years of people doing things differently, so I'm cleaning it up as i run into these issues.  Anyways, I certainly have noticed parts/assemblies which use to be a part of content center, ipart, iassembly etc. because they give error messages.  The only way I know how to immediately distinguish a part like this is one that has the fitting icon

like this - https://knowledge.autodesk.com/support/inventor/learn-explore/caas/sfdcarticles/sfdcarticles/Remove-...

 

Is there another way to distinguish parts that use to be a part of content center, ipart, iassembly ect, or should I just hunt them down once I find errors. (currently I suppress items, run the iLogic and see which is the problem) 

 

Heres the fix for the original problem too:

'iPropertiesRule
	'This rule will change the various iProperties of the Assembly, SubAssemblies and Piece parts.   
	
	'Requires -  User parameters (Text): Designer, Project

Sub main()
	iProp
	iPropColumn
	iPropPartsProject
	iPropPartsDate
	iPropPartsDesigner
End Sub


'Changes Project of Assembly from the input on the form
Sub iProp
	
	iProperties.Value("Project", "Project") = Project

End Sub


'Changes custom Material iProperty for Assembly and Subassemblies, places catelog part number, places desciption based on material
Sub iPropColumn
	
	Select Case PumpSize

		Case "4.0 in"
			
			iProperties.Value("ColumnPipe:1", "Project", "Stock Number") = "PP4SCH40C"
			iProperties.Value("ColumnPipe:1", "Project", "Description") = "PIPE, 4 in SCH40 - PP4SCH40C"
			iProperties.Value("ColumnPipe:1", "Project", "Part Number") = "4 IN COLUMN"

		Case "6.0 in"
			
			iProperties.Value("ColumnPipe:1", "Project", "Stock Number") = "PP6SCH40C"
			iProperties.Value("ColumnPipe:1", "Project", "Description") = "PIPE, 6 in SCH40 - PP6SCH40C"
			iProperties.Value("ColumnPipe:1", "Project", "Part Number") = "6 IN COLUMN"
			
		Case "8.0 in"
			
			iProperties.Value("ColumnPipe:1", "Project", "Stock Number") = "PP8SCH40C"
			iProperties.Value("ColumnPipe:1", "Project", "Description") = "PIPE, 8 in SCH40 - PP8SCH40C"
			iProperties.Value("ColumnPipe:1", "Project", "Part Number") = "8 IN COLUMN"
	
	End Select
	
End Sub


'Goes through all parts & subassemblies and replaces the Project based on form inputs
Sub iPropPartsProject
	
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

'Iterate through all Of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef)  
	
	If oOccurrence.Name = "VTHFAB4-MCI-Simplify:1" Then
	ElseIf oOccurrence.Name = "VTHFAB6-MCIA-Simplify:1" Then
	ElseIf oOccurrence.Name = "VTHFAB8-MCI-Simplify:1" Then	
	
	Else
		'create iprop with default Value
		iProperties.Value("Project", "Project") = Project
		'write to component iprops
		iProperties.Value(oOccurrence.Name, "Project", "Project") = _
		iProperties.Value("Project", "Project")
	End If
	On Error Resume Next
Next

End Sub


'Pulls current date and goes though and updates date for every part, sub assembly and assembly
Sub iPropPartsDate
	
	Dim strFileName As String
	strFileName = ThisDoc.Document.FullFileName
	Dim oFS As Object
	oFS = CreateObject("Scripting.FileSystemObject")
	Dim oDate1 As String
	'Dim oDate2 As String
	oDate1 = oFS.GetFile(strFileName).DateLastModified
	'oDate2 = oFS.GetFile(strFileName).DateCreated

	'MessageBox.Show(oDate1 & " and " & oDate2)

	Dim oAsmCompDef As AssemblyComponentDefinition
	oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

	'Iterate through all Of the occurrences
	Dim oOccurrence As ComponentOccurrence
	For Each oOccurrence In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef)  

	If oOccurrence.Name = "VTHFAB4-MCI-Simplify:1" Then
	ElseIf oOccurrence.Name = "VTHFAB6-MCIA-Simplify:1" Then
	ElseIf oOccurrence.Name = "VTHFAB8-MCI-Simplify:1" Then	
		
	Else
		
			'create iprop with default Value
			iProperties.Value("Project", "Creation Date") = oDate1
			'write to component iprops
			iProperties.Value(oOccurrence.Name, "Project", "Creation Date") = _
			iProperties.Value("Project", "Creation Date")

	End If
		On Error Resume Next
	Next

End Sub


'Pulls designer from form and goes though and updates designer for every part, sub assembly and assembly
Sub iPropPartsDesigner
	
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

'Iterate through all Of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef)  
	
	If oOccurrence.Name = "VTHFAB4-MCI-Simplify:1" Then
	ElseIf oOccurrence.Name = "VTHFAB6-MCIA-Simplify:1" Then
	ElseIf oOccurrence.Name = "VTHFAB8-MCI-Simplify:1" Then	
		
	Else
		'create iprop with default Value
		iProperties.Value("Project", "Designer") = Designer
		'write to component iprops
		iProperties.Value(oOccurrence.Name, "Project", "Designer") = _
		iProperties.Value("Project", "Designer")
	
	End If
	
	On Error Resume Next
Next

End Sub