Use sketchmanager. Don't use the form. It won't work.
Will try to help more tomorrow.
Thank you for your reply!I seem to have found a solution.
But it can only work in.exe addin, and if the program is.dll addin it doesn't work properly.
If you have any better ideas please let me know, thank you.
Imports SolidWorks.Interop.sldworks Imports SolidWorks.Interop.swcommands Imports SolidWorks.Interop.swconst Public Class Form1 Public swApp As SldWorks Private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Integer) Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim swModel As ModelDoc2 Dim swDraw As DrawingDoc Dim swModExt As ModelDocExtension Dim boolstatus As Boolean Dim swAnn As Object swApp = GetObject(, "SldWorks.Application") swModel = swApp.ActiveDoc swDraw = swModel swModExt = swModel.Extension boolstatus = swModExt.RunCommand(swCommands_e.swCommands_DetailView, "My DetailView") Call Sleep(5000) 'code delayed 3s 'Insert "Model Items" swAnn = swDraw.InsertModelAnnotations3(0, 32776, False, False, True, True) End Sub
Why don't you just make that a macro. No need to support the form then.
Create a macro, meaning convert yours to one, Then assign it to a button. Add that button to the annotation command manager tab.