How to Lose Reference or Break Link from each Part in Assembly

How to Lose Reference or Break Link from each Part in Assembly

florian_wenzel
Advocate Advocate
575 Views
3 Replies
Message 1 of 4

How to Lose Reference or Break Link from each Part in Assembly

florian_wenzel
Advocate
Advocate

Hi,

Inventor 2022

API VB.NET VisualStudio

 

i try to Lose Reference or Break Link from each Part in Assembly.

 

This is a Assembly Example.

florian_wenzel_0-1676538555195.png

 

This is a Code, but is not working.

Code:

    Public Sub CommandFunctionfweButton_28()

        Dim oAsmDoc As AssemblyDocument = g_inventorApplication.ActiveDocument
        Dim oAsmCompDef As AssemblyComponentDefinition = oAsmDoc.ComponentDefinition
        Dim oTO As TransientObjects = g_inventorApplication.TransientObjects
        Dim oTG As TransientGeometry = g_inventorApplication.TransientGeometry
        Dim oBRep As TransientBRep = g_inventorApplication.TransientBRep


        For Each oDocument As Document In oAsmDoc.AllReferencedDocuments
            If oDocument.DocumentType = DocumentTypeEnum.kPartDocumentObject AndAlso oAsmCompDef.Occurrences.AllReferencedOccurrences(oDocument).Count > 0 Then
                For Each oDerivedComp As DerivedPartComponent In oDocument.ComponentDefinition.ReferenceComponents.DerivedPartComponents
                    oDerivedComp.BreakLinkToFile()
                Next
            End If
        Next





    End Sub

 Thanks for any Suggestion

0 Likes
Accepted solutions (1)
576 Views
3 Replies
Replies (3)
Message 2 of 4

florian_wenzel
Advocate
Advocate

Part B in Attachment

 

Question:

What is this: 

DerivedPartComponent ?

ReferenceComponents ?

ImportedComponent ?

ReferenceFeature Object ?

 

The Goal is, that i can Delete from Assembly Part "Origin".

And Each Part has no Refereces no more.

 

Thanks for any Suggestion

 

 

 

 

 

 

0 Likes
Message 3 of 4

adam.nagy
Autodesk Support
Autodesk Support
Accepted solution

Well, the Referenzen (Origin:1) object is not supported by the API - so that's not a good start.

https://adndevblog.typepad.com/manufacturing/2015/05/is-this-object-supported-by-the-api.html 

 

It looks like disabling Adaptive on it has the same affect as Break Link and the former is available in the API for the parent object Surface1

 

adamnagy_0-1676925643172.png

 

So perhaps that could be a workaround?

 

VBA code:

 

Sub BreakLink()
  Dim doc As PartDocument
  Set doc = ThisApplication.ActiveDocument

  Dim bf As NonParametricBaseFeature
  Set bf = doc.ComponentDefinition.Features(1)

  bf.Adaptive = False
End Sub

 



Adam Nagy
Autodesk Platform Services
Message 4 of 4

florian_wenzel
Advocate
Advocate

Hi,

 

it works.

Thanks for Solution.

0 Likes