Errors when suppressing a Feature Pattern in a part, when that pattern defines a Feature Based Occurrence Pattern

Errors when suppressing a Feature Pattern in a part, when that pattern defines a Feature Based Occurrence Pattern

wcurtisJM53W
Participant Participant
168 Views
1 Reply
Message 1 of 2

Errors when suppressing a Feature Pattern in a part, when that pattern defines a Feature Based Occurrence Pattern

wcurtisJM53W
Participant
Participant

This topic follows on the discussion at [this topic].  I'm working with iLogic in Inventor Professional 2025.

 

I've got a number of assembly-level component patterns that are tied to part-level feature patterns, and when a part pattern is suppressed, the associated assembly pattern throws various errors, depending on my approach to the problem, even when the assembly patterns and their constraints are suppressed.

 

The structure of my model is:

  • Assembly (with dependent occurrence pattern)
    • Subassembly
      • Part (with defining feature pattern)

 

Based on the above-linked discussion I've created a dummy pattern of the origin point, and I've tried various arrangements with and without proxies for certain components, in an attempt to reassign the assembly's Feature Pattern.  I haven't found an approach that works yet.

 

Here is my current code:

 

 

Dim dHP As Double = 1800 'For the sake of discussion
Dim bHP As Boolean

Dim oDoc_FTA As Inventor.AssemblyDocument = ThisDoc.Document
Dim oDef_FTA As Inventor.AssemblyComponentDefinition = oDoc_FTA.ComponentDefinition
Dim oOccs_FTA As Inventor.ComponentOccurrences = oDef_FTA.Occurrences

Dim oOcc_TSR_a As Inventor.ComponentOccurrence = oOccs_FTA.ItemByName("FT-ST1-2WRE-TSR") 'TSR assembly
Dim oDef_TSR_a As Inventor.AssemblyComponentDefinition = oOcc_TSR_a.Definition
Dim oOccs_TSR_a As Inventor.ComponentOccurrences = oDef_TSR_a.Occurrences

Dim oOcc_TSR_p As Inventor.ComponentOccurrence = oOccs_TSR_a.ItemByName("FT-ST1-2WRE-TSR") 'TSR part
Dim oDef_TSR_p As Inventor.PartComponentDefinition = oOcc_TSR_p.Definition
Dim oPFs_TSR_p As Inventor.PartFeatures = oDef_TSR_p.Features
Dim oCPFs_TSR_p As Inventor.CircularPatternFeatures = oPFs_TSR_p.CircularPatternFeatures

'Find dummy pattern in TSR part and create its proxies
Dim oCPF_Dummy As Inventor.CircularPatternFeature = oCPFs_TSR_p.Item("Dummy Pattern of One")
Dim oCPF_Dummy_Pxy_p As Inventor.CircularPatternFeatureProxy
Dim oCPF_Dummy_Pxy_a As Inventor.CircularPatternFeatureProxy
'Dim oCPF_Dummy_Pxy As Inventor.CircularPatternFeatureProxy

oOcc_TSR_p.CreateGeometryProxy(oCPF_Dummy, oCPF_Dummy_Pxy_p)
oOcc_TSR_a.CreateGeometryProxy(oCPF_Dummy_Pxy_p, oCPF_Dummy_Pxy_a)
'oOcc_TSR_a.CreateGeometryProxy(oCPF_Dummy, oCPF_Dummy_Pxy) 'THROWS ERROR "Unspecified error"

'Find this assembly's feature-based patterns
Dim oOPs_FTA As Inventor.OccurrencePatterns = oDef_FTA.OccurrencePatterns
Dim oFBOP_FTA As Inventor.FeatureBasedOccurrencePattern

'Stay rod border pattern
oFBOP_FTA = oOPs_FTA.Item("Border Arc")
bHP = (dHP > 1800)

Constraint.IsActive("Border Arc Insert") = bHP

If bHP Then
	Dim oCPF_BA As Inventor.CircularPatternFeature = oCPFs_TSR_p.Item("Border Arc")
	Dim oCPF_BA_Pxy_p As Inventor.CircularPatternFeatureProxy
	Dim oCPF_BA_Pxy_a As Inventor.CircularPatternFeatureProxy
'	Dim oCPF_BA_Pxy As Inventor.CircularPatternFeatureProxy
	
	oOcc_TSR_p.CreateGeometryProxy(oCPF_BA, oCPF_BA_Pxy_p)
	oOcc_TSR_a.CreateGeometryProxy(oCPF_BA_Pxy_p, oCPF_BA_Pxy_a)
'	oOcc_TSR_a.CreateGeometryProxy(oCPF_BA, oCPF_BA_Pxy)
	
	oFBOP_FTA.FeaturePattern = oCPF_BA 'THROWS ERROR "The parameter is incorrect"
'	oFBOP_FTA.FeaturePattern = oCPF_BA_Pxy_p 'THROWS ERROR "The parameter is incorrect"
'	oFBOP_FTA.FeaturePattern = oCPF_BA_Pxy_a 'THROWS ERROR "The parameter is incorrect"
	oFBOP_FTA.Unsuppress
Else
	oFBOP_FTA.FeaturePattern = oCPF_Dummy 'THROWS ERROR "The parameter is incorrect"
'	oFBOP_FTA.FeaturePattern = oCPF_Dummy_Pxy_p 'THROWS ERROR "The parameter is incorrect"
'	oFBOP_FTA.FeaturePattern = oCPF_Dummy_Pxy_a 'THROWS ERROR "The parameter is incorrect"
	oFBOP_FTA.Suppress(True)
End If

 

 

Thanks for any assistance.

 

EDITED: Reformatted code for easier reading.

 

0 Likes
Accepted solutions (1)
169 Views
1 Reply
Reply (1)
Message 2 of 2

wcurtisJM53W
Participant
Participant
Accepted solution

I've found a solution that works.  There were two principal things I had to change in my code.

 

First, to create a proxy, finding a feature pattern in a sub-subcomponent has to be done explicitly, level by level.  I created a proxy for the circular pattern feature from the context of the containing part, and then created a proxy for that proxy from the context of the containing subassembly.  I could then work with this in the context of the top assembly.

 

Second, assigning the proxy pattern to define the feature-based occurrence pattern only worked if the FBOP wasn't already using that feature pattern.  I added a test to make sure the new and old patterns are different before trying to assign the new pattern.

 

There might be a more elegant solution, but this gets me to where I need to be.

 

Dim dHP As Double = 1800 'For discussion
Dim bHP As Boolean

Dim oDoc_FTA As Inventor.AssemblyDocument = ThisDoc.Document
Dim oDef_FTA As Inventor.AssemblyComponentDefinition = oDoc_FTA.ComponentDefinition
Dim oOccs_FTA As Inventor.ComponentOccurrences = oDef_FTA.Occurrences

'TSR assembly
Dim oOcc_TSR_a As Inventor.ComponentOccurrence = oOccs_FTA.ItemByName("FT-ST1-2WRE-TSR")
Dim oDef_TSR_a As Inventor.AssemblyComponentDefinition = oOcc_TSR_a.Definition
Dim oOccs_TSR_a As Inventor.ComponentOccurrences = oDef_TSR_a.Occurrences

'TSR part
Dim oOcc_TSR_p As Inventor.ComponentOccurrence = oOccs_TSR_a.ItemByName("FT-ST1-2WRE-TSR")
Dim oDef_TSR_p As Inventor.PartComponentDefinition = oOcc_TSR_p.Definition
Dim oPFs_TSR_p As Inventor.PartFeatures = oDef_TSR_p.Features
Dim oCPFs_TSR_p As Inventor.CircularPatternFeatures = oPFs_TSR_p.CircularPatternFeatures

'Find dummy pattern in TSR part and create its proxies
Dim oCPF_Dummy As Inventor.CircularPatternFeature = oCPFs_TSR_p.Item("Dummy Pattern of One")

Dim oCPF_Dummy_Pxy_p As Inventor.CircularPatternFeatureProxy
Dim oCPF_Dummy_Pxy_a As Inventor.CircularPatternFeatureProxy

oOcc_TSR_p.CreateGeometryProxy(oCPF_Dummy, oCPF_Dummy_Pxy_p)
oOcc_TSR_a.CreateGeometryProxy(oCPF_Dummy_Pxy_p, oCPF_Dummy_Pxy_a)

'Find this assembly's feature-based patterns
Dim oOPs_FTA As Inventor.OccurrencePatterns = oDef_FTA.OccurrencePatterns
Dim oFBOP_FTA As Inventor.FeatureBasedOccurrencePattern

'Stay rod border pattern
oFBOP_FTA = oOPs_FTA.Item("Border Arc")
bHP = (dHP > 1800)

Constraint.IsActive("Border Arc Insert") = bHP

If bHP Then
	oFBOP_FTA.Unsuppress
	
	Dim oCPF_BA As Inventor.CircularPatternFeature = oCPFs_TSR_p.Item("Border Arc")
	
	Dim oCPF_BA_Pxy_p As Inventor.CircularPatternFeatureProxy
	Dim oCPF_BA_Pxy_a As Inventor.CircularPatternFeatureProxy
	
	oOcc_TSR_p.CreateGeometryProxy(oCPF_BA, oCPF_BA_Pxy_p)
	oOcc_TSR_a.CreateGeometryProxy(oCPF_BA_Pxy_p, oCPF_BA_Pxy_a)
	
	If Not oFBOP_FTA.FeaturePattern Is oCPF_BA_Pxy_a Then
		oFBOP_FTA.FeaturePattern = oCPF_BA_Pxy_a
	End If
Else
	If Not oFBOP_FTA.FeaturePattern Is oCPF_Dummy_Pxy_a Then
		oFBOP_FTA.FeaturePattern = oCPF_Dummy_Pxy_a
	End If
	
	oFBOP_FTA.Suppress(True)
End If

 

0 Likes