AnsweredAssumed Answered

CreateSectionViewAt6/5 not working

Question asked by Mark Trupiano on May 1, 2019
Latest reply on May 1, 2019 by Mark Trupiano

I'm trying to write a macro that involves automatically generating a section view within an open drawing. I had no idea how to do this in the API, so I recorded a macro of myself creating the section view, and this is the resulting code generated by the macro recording:


Sub main()

    Set swApp = Application.SldWorks


    Set Part = swApp.ActiveDoc



    Dim myView As Object

    Dim excludedComponents As Variant


    Set myView = Part.CreateSectionViewAt6(0.22, 0.17, 0, "C", 0, (excludedComponents), 0)

    boolstatus = Part.ActivateView("Drawing View2")

    boolstatus = Part.ActivateSheet("Sheet1")

    boolstatus = Part.Extension.SelectByID2("Sheet1", "SHEET", 0.10, 8.07E-02, 0, False, 0, Nothing, 0)

End Sub


But when I go back and try to run this macro I get an error saying 'Object doesn't support this property or method' and debugging points the CreateSectionViewAt6 method. After a bit of research I learned their are older versions of the CreateSectionViewAt method, so I tried substituting CreateSectionViewAt6 with CreateSectionViewAt5. The macro runs without error using this method, but the section view doesn't actually get created. The same goes when I tried using CreateSectionViewAt4 as well. I'm really not sure what I'm missing here, but any help is appreciated!