Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Supress Link with base component ilogic

6 REPLIES 6
Reply
Message 1 of 7
PIBAL
1991 Views, 6 Replies

Supress Link with base component ilogic

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.

 

 

 

Untitled.png

6 REPLIES 6
Message 2 of 7
PIBAL
in reply to: PIBAL

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

Message 3 of 7
adam.nagy
in reply to: PIBAL

Hi,

 

So it looks like you've found the solution. 

Could you please set your update as "Accepted Solution" then? 🙂

 

Cheers,



Adam Nagy
Autodesk Platform Services
Message 4 of 7
NCostelloe
in reply to: adam.nagy

Hi guys,

 

Is it possible to do this with Break Link?

 

Thanks

Nathan Costelloe

Inventor Professional 2022
Windows 10
Intel Xeon W-2133 3.6 GHz
Nvidia Quadro P4000 16Gb
Message 5 of 7
PIBAL
in reply to: NCostelloe

For sure 😉  i am are waiting for you to change the code.

 

Message 6 of 7
NCostelloe
in reply to: PIBAL

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

Nathan Costelloe

Inventor Professional 2022
Windows 10
Intel Xeon W-2133 3.6 GHz
Nvidia Quadro P4000 16Gb
Message 7 of 7
Anonymous
in reply to: NCostelloe

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report