- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I have a main assembly containing sub-assemblies with rules that edits features in the sub-assembly. Most of the rules work well as they are simple (changes to dimensions, increasing the number of instances in a pattern); however, one rule does not.
A patterned feature in a sub-assembly has an extended cut affecting it; when I add additional occurrences of the pattern, the extruded cut does not happen to these occurances. I have found that I need to create a rule to add the occurrences of the pattern to the feature: using this rule:
Dim oDoc As AssemblyDocument oDoc = ThisApplication.ActiveDocument Dim oDef As AssemblyComponentDefinition oDef = oAsmDoc.ComponentDefinition Dim oPat As OccurrencePattern oPat = oDef.OccurrencePatterns.Item("Component Pattern 4") Dim oAssemblyFeatures As Features oAssemblyFeatures = oDef.Features Dim oAssemblyFeature As PartFeature 'Iterate through all of the assembly features For Each oAssemblyFeature In oAssemblyFeatures If oAssemblyFeature.Name = "Extrude 1" Then 'look at the pattern elements Dim oPatE As OccurrencePatternElement For Each oPatE In oPat.OccurrencePatternElements 'look at the pattern element contents Dim oOcc As ComponentOccurrence For Each oOcc In oPatE.Occurrences 'add the element contents to the feature oAssemblyFeature.AddParticipant(oOcc) Next Next End If Next
Which I found from @Curtis_Waguespack post here https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/ilogic-commands-for-adding-a-partici...
I then try to run from this from the main assembly with a simple:
ilogicVb.RunRule("A003.1 - Fabric", "Run rules 1")
I receive the following error
Error on line 8 in rule: Include Pattern Parts, in document: A003.1 - Fabric.iam
Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
I believe this is caused by the fact that the document containing the rule is not active. This line.
oDoc = ThisApplication.ActiveDocument
Is there a simple solution to this?
I have a basic understanding of iLogic, so if you can explain each step, It would be much appreciated.
Solved! Go to Solution.