in an assembly i have a pattern wich consists of a series of profiles i want to be able to easily replace a single pattern element with a different variety of profile. the way i have it build now is that the other variety of profile is always in the assembly but the visibility is turned off then i use a parameter to specify the element that has to be 'replaced' but all i do is supress de element en switch the visibility of the other profile. here a simplified version of the code i'm using right now:
AddVbFile "NXTdimConnector.iLogicVb"
'Try to make connection with NXTdim Dim NXTdim As Object = NXTdimConnector.GetNXTdimiLogicAutomation(ThisApplication) If NXTdim Is Nothing Then MessageBox.Show("Could not connect to the NXTdim Inventor iLogic extension library.", "NXTdim", MessageBoxButtons.OK, MessageBoxIcon.Stop) Exit Sub End If Dim oDef As AssemblyComponentDefinition = ThisApplication.ActiveDocument.ComponentDefinition 'Dim oPattern As OccurrencePattern For Each oPattern In oDef.OccurrencePatterns For Each oElement As OccurrencePatternElement In oPattern.OccurrencePatternElements If oElement.Suppressed = True Then oElement.Suppressed = False End If Next Next Dim oDoc As AssemblyDocument oDoc = ThisApplication.ActiveDocument 'reference the pattern in the assembly Dim oPattern As OccurrencePattern 'calls the pattern by name oPattern = oDoc.ComponentDefinition.OccurrencePatterns.Item("Component Pattern 10:1") oPattern.OccurrencePatternElements.Item(parameter specifying element).Suppressed = True NXTdim.SetOccurrenceVisibilityByName(ThisDoc.Document, "different profile", True)
even though this works for the application what i would really like to do is first make the element indepent and then replace it because this would be better for usage in different situations. now making the element independent is no problem but specifying the component to replace is where i'm stuck since the reference can change when it's a different element that needs replacing.
any help or advice would be greatly appreciated.
regards,
Jeremy
Solved! Go to Solution.