Hi Guys
I want to change the position of the CBore hole to some different location,Following is my code in which I am trying to edit point position of Hole sketch.But SolidWorks Hangs at this line given in code.
Can anyone please help me to find the solution????
Dim sketch1 As SldWorks.Sketch = Nothing
Dim feat As SldWorks.Feature = swFeat.GetFirstSubFeature() ' SwFeat is Cbore Hole feature object
Do Until feat Is Nothing
If feat.GetTypeName = "ProfileFeature" Then
Dim sketchPointArray As Object
sketch1 = feat.GetSpecificFeature
If sketch1 Is Nothing Then
Continue Do
End If
feat.Select(True)
swModel.EditSketch()
sketchPointArray = sketch1.GetSketchPoints2()
Dim pntCnt As Integer
pntCnt = UBound(sketchPointArray) + 1
Dim sketchPnt As SldWorks.SketchPoint
If pntCnt >= 1 Then
sketchPnt = sketchPointArray(0)
swModel.ClearSelection2(True)
sketchPnt.Select(True)
sFeatPlane2.Select(True)
swModel.AddDimension2(0, 0, 0) ' After this line the SolidWorks Hangs unable to resolve the problem
Dim param As SldWorks.Dimension
param = swModel.Parameter("D1@Sketch2")
param.SystemValue = 0.15
sketchPnt.SetCoords(0, 0, 0)
End If
swModel.InsertSketch2(True)
swModel.EditRebuild3()
End If
feat = swFeat.GetNextSubFeature
Loop
Regards,
Sameer Deshmukh.
SolidworksApi macros