还有个问题请教下,如下,为什么我修改的标注尺寸和实际的不一样?我想改成15度,但是输入0.015改的却不是15度
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim skSegment As SldWorks.SketchSegment
Dim myDisplayDim As SldWorks.DisplayDimension
Dim myDimension As SldWorks.Dimension
Dim myFeature As SldWorks.Feature
Sub main()
Set swApp = _
Application.SldWorks
Set Part = swApp.ActiveDoc
boolstatus = Application.SldWorks.SetUserPreferenceToggle(swInputDimValOnCreate, False)
boolstatus = Part.Extension.SelectByID2("前视基准面", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
Part.SketchManager.InsertSketch True
Dim skSegment As Object
Set skSegment = Part.SketchManager.CreateCenterLine(0#, 0#, 0#, 0.2, 0#, 0#)
Set skSegment = Part.SketchManager.CreateLine(0#, 0#, 0#, 0, 0.02, 0#)
Set skSegment = Part.SketchManager.CreateLine(0#, 0.02, 0#, 0.046508, 0.038258, 0#)
Set skSegment = Part.SketchManager.CreateLine(0.046508, 0.038258, 0#, 0.158669, 0.038258, 0#)
Set skSegment = Part.SketchManager.CreateLine(0.158669, 0.038258, 0#, 0.180055, 0#, 0#)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Line3", "SKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("Line4", "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
Set myDisplayDim = Part.AddDimension2(-0.0005, 0.024, 0)
Part.ClearSelection2 True
Set myDimension = Part.Parameter("D1@草图1")
myDimension.SystemValue = 0.015
Part.ClearSelection2 True
end sub |