Const Pi As Single = 3.14159265358979
Dim line11 As SldWorks.SketchSegment
Dim line12 As SldWorks.SketchSegment
Dim line13 As SldWorks.SketchSegment
Dim line14 As SldWorks.SketchSegment
Dim line15 As SldWorks.SketchSegment
Dim line16 As SldWorks.SketchSegment
Dim linecenter4 As SldWorks.SketchSegment
Dim Swapp As SldWorks.SldWorks '声明变量是其接口类型,或者声明变量是一个应用
Dim Part As SldWorks.ModelDoc2 '声明part是模型文件
Dim Sketchmer As SldWorks.SketchManager '声明变量是草图类型
Dim Featmgr As SldWorks.FeatureManager
Swapp = CreateObject("Sldworks.application") '链接solidworks,变量指向sld
Part = Swapp.ActiveDoc '获得当前活动文档的对象
Sketchmer = Part.SketchManager
Featmgr = Part.FeatureManager
Part.Extension.SelectByID2("前视基准面", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
Sketchmer.InsertSketch(True)
line11 = Sketchmer.CreateLine(0, 1.345, 0, -0.04, 1.345, 0)
line12 = Sketchmer.CreateLine(-0.04, 1.345, 0, -0.04, 1.77, 0)
line13 = Sketchmer.CreateLine(-0.04, 1.77, 0, -0.08, 1.805, 0)
line14 = Sketchmer.CreateLine(-0.08, 1.805, 0, -0.08, 1.845, 0)
line15 = Sketchmer.CreateLine(-0.08, 1.845, 0, 0, 1.845, 0)
line16 = Sketchmer.CreateLine(0, 1.845, 0, 0, 1.345, 0)
linecenter4 = Sketchmer.CreateCenterLine(0, -0.1, 0, 0, 3, 0)
Part.Extension.SelectByID2("草图1", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
Featmgr.FeatureRevolve2(True, True, False, False, False, False, 0, 0, 360 * Pi / 180, Pi, False, False, 0, 0, 0, 0, 0, True, True, True) |