- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have an assembly with multiple sheet metal parts that I'm trying to use iLogic to change the material of. The log indicates that the material change command went through, and the BOM when accessed from the assembly level seems to corroborate that. However if I open the actual part file the material doesn't change. What's interesting is that the material saves in this state - if I close everything and open again I still get an assembly and part that disagree on the material of the part. Any ideas what I'm doing wrong?
Dim MaterialChangeDocList As New ArrayList
Dim oAssemDoc As AssemblyDocument = odoc
Dim oLeafOcc As ComponentOccurrence
For Each oOcc In odoc.ComponentDefinition.Occurrences.AllLeafOccurrences
If Left(oOcc.Definition.Document.FullFileName,"<FILE DIRECTORY STRING>".Length) = "<FILE DIRECTORY STRING>"
If oOcc.Definition.Document.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"
If oOcc.Definition.Document.PropertySets.Item("Design Tracking Properties").Item("Material").Value = "Fiberglass"
Else
If MaterialChangeDocList.Contains(oOcc.Definition.Document.FullFileName) Or oOcc.Definition.Document.FullFileName = "<FILE DIRECTORY STRING>Custom_Builder_00.ipt"
Else
MaterialChangeDocList.Add(oOcc.Definition.Document.FullFileName)
Logger.Debug("PRE - " & oOcc.Definition.Document.PropertySets.Item("Design Tracking Properties").Item("Material").Value)
If (oOcc.Definition.Document.FullFileName = "<FILE DIRECTORY STRING>Custom_Builder_FG_01.ipt") And (MaterialGradeForRails = "PO A36 MS")
oOcc.Definition.Document.PropertySets.Item("Design Tracking Properties").Item("Material").Value = "AP A36 MS"
Else
oOcc.Definition.Document.PropertySets.Item("Design Tracking Properties").Item("Material").Value = MaterialGradeForRails
End If
iLogicVb.RunRule(oOcc.Name, "Identify Sheet Stock Code")
Logger.Debug("POST - " & oOcc.Definition.Document.PropertySets.Item("Design Tracking Properties").Item("Material").Value)
oOcc.Definition.Document.Update
oOcc.Definition.Document.Save
oOcc.Definition.Document.Close
End If
End If
End If
End If
Next
(IT has been on a security crackdown recently so I took out the file directories because they mention company info). It's pretty simple, checks a bunch of conditions to find the exact parts that need their materials changed (eventually I'll clean up that block of if statements) then change the materials of the part directly through the iProperties.
Solved! Go to Solution.