Hello All,
Recently I have been using a macro to automatically create an exploded view of an assembly to show the components within that assembly without going through the pain of spacing each part out manually. I have paired this with a SW drawing template with predefined views and SW task scheduler to improve the efficiency of my drawing creation down to just a few clicks.
The problem that I have been running into lately is an assembly document with multiple subassemblies within the top-level. My goal is to have the macro to explode the top-level assembly while keeping the subassemblies underneath it fully assembled. With multiple days of google searches and hours of Youtube videos (along with being a novice programmer) I have yet to find any sort of robust solution to this. Has anyone encountered this problem, or am I just swimming in circles?
Thanks in advance!

The quickest and easiest way to do this is to convert it to an eDrawing and open it within the eDrawing software. On the lower left-hand side of the screen, you'll see "explode." I've had my machine builders use this feature for years.
let me know when you get that macro to work...
Are you willing to share your macro here? If the change is simple enough, someone might be able to help you.
Yes I can definitely share the macro. Here it is: Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swAssembly As SldWorks.AssemblyDoc
'Dim swApp As SldWorks.SldWorks
Dim vViewName As Variant
Dim sViewName As String
Dim i As Long
Dim getAssy As Object
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swAssembly = swModel
'getAssy = InputBox("Select Subassemblies and Piece Parts from FG to Explode", "Create Exploded View")
' Create exploded view
For i = 0 To 0
swAssembly.CreateExplodedView
Next i
vViewName = swAssembly.GetExplodedViewNames
Debug.Print "Number of exploded views created: " & swAssembly.GetExplodedViewCount
For i = 0 To UBound(vViewName)
sViewName = vViewName(i)
Debug.Print " Exploded view name: " & sViewName
Next i
Stop
For i = 0 To UBound(vViewName)
sViewName = vViewName(i)
Call swAssembly.ShowExploded2(True, sViewName)
Next i
Stop
For i = 0 To UBound(vViewName)
sViewName = vViewName(i)
Call swAssembly.ShowExploded2(False, sViewName)
Next i
Stop
swAssembly.ViewExplodeAssembly
Stop
swAssembly.ViewCollapseAssembly
End Sub
"CreateExplodedView" explodes all parts inside the active assembly. If you only want to exploded top level assemblies, then after creating the exploded view, you will have to get the first step, delete it, select one or more top level components depending on how you want to exploded them and then use IConfiguration::AddExplodedStep2 method to create exploded views programatically. Please keep in mind that you will have to figure out distance, diection etc. for each step. You need to repeat this method until you process all top level components.