My program draws inserts a 3D Sketch to programmatically draw a 3D line. However after between a few to 20 tries Solidworks will lock up when the Sketch is created. What am I doing wrong? These crashes have been consistent for both Assembly and Part Model space (swModel). Here is the code:
Dim swFeat As SolidWorks.Interop.sldworks.Feature
Dim swSkPoint1 As SolidWorks.Interop.sldworks.SketchPoint
Dim swSkPoint2 As SolidWorks.Interop.sldworks.SketchPoint
Dim swSkLine As SolidWorks.Interop.sldworks.SketchLine
Dim bRet As Boolean
swModel.SetAddToDB(True)
swModel.Insert3DSketch2(False)
swSkPoint1 = swModel.CreatePoint2(P1x, P1y, P1z)
swSkPoint2 = swModel.CreatePoint2(P2x, P2y, P2z)
swSkLine = swModel.CreateLine2(P1x, P1y, P1z, P2x, P2y, P2z)
swModel.SetAddToDB(False)
TempSketch = swModel.GetActiveSketch2
swFeat = TempSketch
swFeat.Name = "DispMeaSketch"
swModel.Insert3DSketch2(True)
bRet = swModel.EditRebuild3
SolidworksApi macros