Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Hi @machiel.veldkamp 

 

This should output the member files (the same as right clicking on the members in the browser and choosing Generate Files) however it does't work... so that is why the break link function does not work.

 

I'm not sure why this is not working in iAssemblies, there might simply be something else we have to do first, but I'm not sure.

 

Dim oParent As iAssemblyFactory
oParent = ThisDoc.Document.ComponentDefinition.iAssemblyFactory

Dim oRow As iAssemblyTableRow

For Each oRow In oParent.TableRows
	oParent.CreateMember(oRow)
Next

In any case, here is an example that gets the iAssembly cache folder from the factory file, and opens each assembly, then checks to make sure it is an iAssembly member and then breaks the link, saves and closes

 

Dim oParent As iAssemblyFactory
oParent = ThisDoc.Document.ComponentDefinition.iAssemblyFactory

Dim oRow As iAssemblyTableRow
Dim oDoc As AssemblyDocument
Dim oDef As AssemblyComponentDefinition

oMemberFolder = oParent.MemberCacheDir

Dim fileEntries As String() = System.IO.Directory.GetFiles(oMemberFolder,"*.iam")
Dim fileName As String
For Each fileName In fileEntries
	oDoc = ThisApplication.Documents.Open(fileName, False)
	oDef = oDoc.ComponentDefinition
	If oDef.IsiAssemblyMember Then
		oMember = oDef.iAssemblyMember
		oMember.BreakLinkToFactory
		oDoc.save
	End If
	oDoc.close
Next

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com