AnsweredAssumed Answered

How to apply a macro to a part being edited in context of an assembly?

Question asked by John Maldonado on Sep 7, 2017
Latest reply on Sep 8, 2017 by John Maldonado


I'm trying to modify my macro to be functional while a part is being edited from an assembly

Essentially what my macro does is take a pre-selected 3d sketch, Edits the sketch and add fillets to the intersections, exits the sketch, then creates a circular profile sweep from the sketch.

My code works file when I have the part opened directly. I'm hoping to change it to work on a part edited in an assembly.

I have a feeling it is because of my swApp.ActiveDoc declaration, I'm not sure if it pics up the assembly or the part being edited.

I can upload the whole code if needed.

Thank you,


Here are my declarations in the code


    Dim swApp               As SldWorks.SldWorks

    Dim swMsgInput          As Integer

    Dim swModel             As SldWorks.ModelDoc2

    Dim swSelMgr            As SldWorks.SelectionMgr


    Dim swSketch            As SldWorks.Sketch

    Dim swSketchPoint As SldWorks.SketchPoint

    Dim sketchPointArray As Variant

    Dim SketchPointCount As Integer

    Dim SketchName As String

    Dim boolstatus As Boolean

    Dim longstatus As Long, longwarnings As Long

    Dim strBlank As String

    Dim i As Long

    Dim xValue As Double

    Dim yValue As Double

    Dim zValue As Double


    Set swApp = CreateObject("SldWorks.Application")

    Set swModel = swApp.ActiveDoc

    Set swSelMgr = swModel.SelectionManager