Edit all parts of Assembly

Edit all parts of Assembly

Anonymous
Not applicable
487 Views
3 Replies
Message 1 of 4

Edit all parts of Assembly

Anonymous
Not applicable

Hello,

 

I have a script that updates some iproperties and does some fancy things to the parts we create. it works like a charm, but Now we need to run it on old files.

 

I would need an Ilogic script, that you run on an Assembly, and all it does is iterate all parts, and if it is an IPT then it activates it (like qhen you activate it for editing) waits a second and then deactivates it. 

 

this procedure will automatically run the script on every ipt that we have in that big assembly and would run on its own. I would like a solution like this better than editing the main script.

 

Can this be done? I know how to go through an assembly recursively, just would need to understand how to edit a file and then stop editing...

 

thanks

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

marcin_otręba
Advisor
Advisor
Accepted solution

do you really need to edit that document ?

 

if not you can use

 

Dim ass As AssemblyDocument
Set ass = ThisApplication.ActiveDocument
Dim pdoc As PartDocument
For Each pdoc In ass.AllReferencedDocuments
-----run you ilogic here

------ or use   pdoc.Views.Add to open in new window
Next

 

 

if you want to edit then:

Private Sub aa()
Dim oAsmDoc As AssemblyDocument
Set oAsmDoc = ThisApplication.ActiveDocument
    Call TraverseAssembly(oAsmDoc.ComponentDefinition.Occurrences)
   
End Sub

Private Sub TraverseAssembly1(Occurrences As ComponentOccurrences)
 On Error Resume Next
    Dim oOcc As ComponentOccurrence
    For Each oOcc In Occurrences
        If oOcc.DefinitionDocumentType = kAssemblyDocumentObject Then
            Call TraverseAssembly(oOcc.SubOccurrences)
        End If
        If oOcc.Definition.Document.DocumentType = kPartDocumentObject Then
               oOcc.Edit
               

-----run you ilogic here


               oOcc.ExitEdit
                
        End If
Next
End Sub

 

 

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

Message 3 of 4

Anonymous
Not applicable

Thanks, it works, but it crashes on iparts. is there a way to skip iparts?

0 Likes
Message 4 of 4

marcin_otręba
Advisor
Advisor
Accepted solution

try IsiPartMember if is true then skip

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders