Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I am trying to make a rule where the user is prompted to select a particular sub assembly then it will apply values to its iProperties. My issue is that if I use the method of CommandManager.Pick then I don't know how to apply a custom iproperty using oOccurrence. Then if I want to use my typical method for applying custom iproperties via documents I don't know how to make the Pick in terms of document type.
So, is there a way to
a) apply custom iProperties through oOccurrence (Assembly to sub assembly/parts)
b) prompt a user to make a selection using document type
or if theres another way im all ears.
Selection Method
' Selection Dim oOccurence As Inventor.ComponentOccurrence = ThisApplication.CommandManager.Pick(Inventor.SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, "select") Dim oAry As Array = Split(oOccurence.Name, ":") Dim oAsmDoc As Inventor.AssemblyDocument = ThisDoc.Document Dim oSlct As Inventor.SelectSet = oAsmDoc.SelectSet Dim oOccEnum As ComponentOccurrencesEnumerator = oAsmDoc.ComponentDefinition.Occurrences.AllReferencedOccurrences(oOccurence.Definition) Dim oObjColl As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection For Each oOcc As ComponentOccurrence In oOccEnum oOcc.PropertySets("Inventor User Defined Properties").Item("S0Class").Value = "1" Next
Typically how I apply iprops to sub assemblies
For Each oRefDoc As Document In oRefDocs ' Skipping any purchased or mfg parts / any parts that are not accessable If oRefDoc.IsModifiable() = True AndAlso oRefDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then Dim oCustomPropertySet As PropertySet oCustomPropertySet = ThisApplication.ActiveDocument.PropertySets.Item("Inventor User Defined Properties") Dim oCustProp As Inventor.Property For Each oCustProp In oCustomPropertySet oRefDoc.PropertySets("Inventor User Defined Properties").Item("CUSTOMER NAME-1").Value = CUSTOMERNAME1 oRefDoc.PropertySets("Inventor User Defined Properties").Item("CUSTOMER PO#").Value = CUSTOMERPO oRefDoc.PropertySets("Inventor User Defined Properties").Item("END USER-1").Value = ENDUSER1 Next Else ' Do Nothing End If Next
Solved! Go to Solution.