[iLogic] How to open drawings of the selected components in assembly ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want to run a ilogic rule and select components in assembly browser, then open drawings of them.
Here is my existing code,However, it can only open drawings in the same folder as the part。
how to edit the code to open drawings in all folders in a workspace。
thanks
Imports File = System.IO.File
Imports Path = System.IO.Path
Sub main
Dim oAsmDoc = ThisDoc.Document
If oAsmDoc.DocumentType <> kAssemblyDocumentObject Then
MsgBox("Must running in an assembly!", , "Pmhker")
Return
End If
Dim oDoc As AssemblyDocument = ThisDoc.Document
oCompDef = oDoc.ComponentDefinition
Dim oSet As HighlightSet = oDoc.CreateHighlightSet
Dim comps As ObjectCollection
Dim comp As Object
comps = ThisApplication.TransientObjects.CreateObjectCollection
While True
comp = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter,"Select components,Press_Esc_to finish select")
If IsNothing(comp) Then Exit While
comps.Add(comp)
oSet.AddItem(comp)
End While
For Each comp In comps
ofile = comp.Definition.document
ofilename = ofile.fullfilename
fullname = Path.ChangeExtension(ofilename, ".idw")
If File.Exists(Path.ChangeExtension(fullname, ".idw")) Then
ThisApplication.Documents.Open(fullname, True)
'ThisDoc.Launch(fullname & IDWType)
Else
MsgBox("Drawing of" & ofilename & "can't found",,"Pmhker")
End If
Next
End Sub
If my post answers your question, please click the "Accept as Solution" button. This helps everyone find answers more quickly!
如果我的回帖解决了您的问题,请点击 "接受为解决方案" 按钮. 这可以帮助其他人更快的找到解决方案!
王 承之
Autodesk AGN [Inventor 俱乐部] Leader
Inventor Club | Bilibili