
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello All,
I'm new in iLogic functionally, but it gets me much satisfaction programming in it. Now I work on feature passing custom iproperties to parts and subassmeblies.
For example, I have parent assembly including parts and subassmblies. What I want to do is pass iproperty called "Drawing Number" of parent assembly to subparts, but not subassmeblies. Then if parent assembly has subassmebly, I would like to pass to parts in subassembly "Drawing Number" of subassembly.
I find out how to do this let's say in "one level assembly" (when assmembly doesn't have subassmeblies ), but I don't know how to go deeper. And It will be good if parts from Content Center stay unmodified.
Maybe some image tells what I mean:
And code, which I made:
Sub Main Drawing_Number() DrawNo=iProperties.Value("Project", "Part Number") Dim oDoc As AssemblyDocument oDoc = ThisApplication.ActiveDocument Dim oDef As AssemblyComponentDefinition oDef = oDoc.ComponentDefinition Dim oOcc As ComponentOccurrence For Each oOcc in oDef.Occurrences If oOcc.SubOccurrences.Count = 0 Then Dim docFile As Document For Each docFile In oDoc.ReferencedDocuments If docFile.IsModifiable = False Then 'skip Else If docFile.IsModifiable = True Dim invCustomPropertySet As PropertySet= docFile.PropertySets.Item("Inventor User Defined Properties") Try Dim invVolumeProperty As Inventor.Property = invCustomPropertySet.Item("Drawing Number") invVolumeProperty.Value = DrawNo Catch Call invCustomPropertySet.Add(DrawNo, "Drawing Number") End Try End If Next Else Call CheckSubAssem(oOcc) End If Next ' MassOfVisible=Round(MassOfVisible,2) ' iProperties.Value("Custom", oDef.RepresentationsManager.ActiveDesignViewRepresentation.Name)=MassOfVisible End Sub Public Sub CheckSubAssem(ByVal oCompOcc As ComponentOccurrence) Dim oSubCompOcc As ComponentOccurrence 'MessageBox.Show(DrawNo, "Title") For Each oSubCompOcc In oCompOcc.SubOccurrences If oSubCompOcc.SubOccurrences.Count = 0 Then MessageBox.Show(oCompOcc.Name, "Title") DrawNo1=oCompOcc.Name Dim docFile As Document Dim oDoc As AssemblyDocument oDoc = ThisApplication.ActiveDocument For Each docFile In oDoc.ReferencedDocuments If docFile.IsModifiable = False Then 'skip Else If docFile.IsModifiable = True Dim invCustomPropertySet As PropertySet= docFile.PropertySets.Item("Inventor User Defined Properties") Try Dim invVolumeProperty As Inventor.Property = invCustomPropertySet.Item("Drawing Number") invVolumeProperty.Value = DrawNo1 Catch Call invCustomPropertySet.Add(DrawNo1, "Drawing Number") End Try End If Next Else Call CheckSubAssem(oSubCompOcc) End If Next End Sub
Solved! Go to Solution.