AnsweredAssumed Answered

API crashing Solidworks with 3D Sketch

Question asked by Edwin Thompson on Aug 12, 2016
Latest reply on Aug 15, 2016 by Edwin Thompson

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




swSkPoint1 = swModel.CreatePoint2(P1x, P1y, P1z)

swSkPoint2 = swModel.CreatePoint2(P2x, P2y, P2z)

swSkLine = swModel.CreateLine2(P1x, P1y, P1z, P2x, P2y, P2z)



TempSketch = swModel.GetActiveSketch2

swFeat = TempSketch

swFeat.Name = "DispMeaSketch"


bRet = swModel.EditRebuild3