Can you help me use this option in ilogic ?
I have configurator based on derived part. The base part is an ipart. After changing the row i'd like to supress or break all links to the "mother" ipart.
Have i found right object ?
DerivedAssemblyComponentProxy.LinkedToFile() As Boolean
How to use it.
Sub Main()
Dim assm As AssemblyDocument
assm = ThisApplication.ActiveDocument
Dim occ As ComponentOccurrence
Dim derpart As DerivedPartComponent
Dim partdoc As PartDocument
'it f you want to use all components'
Dim doc as AssemblyDocument = ThisDoc.Document
Dim oLOD As LevelOfDetailRepresentation
Dim oAsmCompDef As ComponentDefinition
oAsmCompDef = doc.ComponentDefinition
Try
oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("Master").Activate(True)
Catch
Dim nLOD As LevelOfDetailRepresentation
nLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Add("Master")
oLOD = nLOD
Finally
oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("Master").Activate(True)
End Try
For Each occ In assm.ComponentDefinition.Occurrences
If occ.DefinitionDocumentType = kPartDocumentObject Then
For Each derpart In occ.Definition.ReferenceComponents.DerivedPartComponents
derpart.SuppressLinkToFile = True
iLogicVb.UpdateWhenDone = True
Next
' ElseIf occ.DefinitionDocumentType = kAssemblyDocumentObject Then
' 'Call processAllSubOcc(occ) ' subassembly
End If
Next
End Sub
'
'' This function is called for processing sub assembly. It is called recursively
'' to iterate through the entire assembly tree.
'Sub processAllSubOcc(ByRef occ As ComponentOccurrence)
'
'Dim derpart As DerivedPartComponent
'Dim oSubCompOcc As ComponentOccurrence
' For Each oSubCompOcc In occ.SubOccurrences
' ' Check if it's child occurrence (leaf node)
'
' If oSubCompOcc.DefinitionDocumentType = kPartDocumentObject Then
' For Each derpart In occ.Definition.ReferenceComponents.DerivedPartComponents
' 'My Code
' If derpart.SuppressLinkToFile = True Then
' derpart.SuppressLinkToFile= False
'
' Else derpart.SuppressLinkToFile = True
'
' End If
'
' derpart.SuppressLinkToFile = True
'
' iLogicVb.UpdateWhenDone = True
' Next
' ElseIf occ.DefinitionDocumentType = kAssemblyDocumentObject Then
' Call processAllSubOcc(occ) ' subassembly
' End If
' Next
'
'End Sub
Hi,
So it looks like you've found the solution.
Could you please set your update as "Accepted Solution" then? 🙂
Cheers,
Hi guys,
Is it possible to do this with Break Link?
Thanks
Figured it out...
Replace the line
derpart.SuppressLinkToFile = True
with
derpart.BreakLinkToFile
It was the True/False that was stuffing me up! 😉
By the way if you want to Unsurppress the Link then
derpart.SuppressLinkToFile = False
hi, I just read this thread.
It seems, you solved the problem, but this code does not work in my assm.
I am working with autodesk inventor 2013
It appers the failure:
expect "end of" command in lines 18, 21, 24 and 29
I don`t know what do with it.
Could you give me a hint, please.
P.S. sorry for my bad english