我自己编写了一个偏移的程序,但是只能输入偏移的距离,无法控制偏移的方向,请问各位高手,怎么控制偏移的方向?
程序如下:
Sub offsethxy()
Dim number As Integer
Dim i As Integer
Dim ObjSelectionSet As AcadSelectionSet
i = 0
'获取当前图形中选择集的个数
number = ThisDrawing.SelectionSets.Count
'删除当前图形中所有的选择集
While i < number
Set ObjSelectionSet = ThisDrawing.SelectionSets.item(0)
ObjSelectionSet.Delete
i = i + 1
Wend
'创建命令执行需要的选择集
Set ObjSelectionSet = ThisDrawing.SelectionSets.Add("SSET")
Dim ofobject As AcadObject
Set ofobject = ObjSelectionSet.item(0)
Dim offsetObj As Variant
Dim Distance As Double
Dim returnReal As Double
Dim sysVarName As String
Dim varData As Variant
sysVarName = "DIMLFAC"
varData = ThisDrawing.GetVariable(sysVarName)
returnReal = ThisDrawing.Utility.getreal("请输入偏移距离: ")
Distance = returnReal / varData
offsetObj = ofobject.Offset(Distance)
End Sub