Hi
I have an assembly with sub asse,bly structures.
In all total 2500 part files.
All part files is now derived from basepart.
I want to stop derive for all solids in all files.
This can be done manually by opening part, right click on solid, chose recovery and afeter some nexts chose stop derive.
Code have to iterate through all solids in all parts.
I have no clue for where to start, but this is way to time-consuming to do manually
Someone that can help?
It would be great if code can be run both in .ipt and .iam.
In .iam working from active .iam document and downwards in structure
Br
Marius A
Solved! Go to Solution.
Solved by Michael.Navara. Go to Solution.
This code breaks all links for each derived components in active document and all referenced documents.
Perhaps it is good starting point for you
Sub Main()
Dim activeDoc As Document = ThisDoc.Document
If activeDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
BreakLinkForDerivedComponent(activeDoc)
Return
End If
For Each refDoc As Document In activeDoc.AllReferencedDocuments
If refDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
Continue For
End If
If refDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
BreakLinkForDerivedComponent(refDoc)
Continue For
End If
Logger.Warn("Strange document " & refDoc.DisplayName)
Next
End Sub
Sub BreakLinkForDerivedComponent(part As PartDocument)
For Each derivedPartComp As DerivedPartComponent In part.ComponentDefinition.ReferenceComponents.DerivedPartComponents
derivedPartComp.BreakLinkToFile()
Next
For Each derivedAsmComp As DerivedPartComponent In part.ComponentDefinition.ReferenceComponents.DerivedAssemblyComponents
derivedAsmComp.BreakLinkToFile()
Next
'Another possibilities but usually not used
'part.ComponentDefinition.ReferenceComponents.DerivedAliasComponents
'part.ComponentDefinition.ReferenceComponents.DerivedFutureAssemblyComponents
'part.ComponentDefinition.ReferenceComponents.DerivedFuturePartComponents
End Sub
Can't find what you're looking for? Ask the community or share your knowledge.