请问各位高手,如何控制偏移的方向?
我自己编写了一个偏移的程序,但是只能输入偏移的距离,无法控制偏移的方向,请问各位高手,怎么控制偏移的方向?程序如下:
Sub offsethxy()<BR> Dim number As Integer<BR> Dim i As Integer<BR> Dim ObjSelectionSet As AcadSelectionSet<BR> i = 0<BR> <BR> '获取当前图形中选择集的个数<BR> number = ThisDrawing.SelectionSets.Count<BR> <BR> '删除当前图形中所有的选择集<BR> While i < number<BR> Set ObjSelectionSet = ThisDrawing.SelectionSets.item(0)<BR> ObjSelectionSet.Delete<BR> i = i + 1<BR> Wend<BR> <BR> '创建命令执行需要的选择集<BR> Set ObjSelectionSet = ThisDrawing.SelectionSets.Add("SSET")<BR> <BR> '向选择集中添加边界对象<BR> ThisDrawing.Utility.Prompt "请选择偏移对象:"<BR> ObjSelectionSet.SelectOnScreen<BR> <BR> Dim ofobject As AcadObject
Set ofobject = ObjSelectionSet.item(0)
Dim offsetObj As Variant<BR> Dim Distance As Double<BR> Dim returnReal As Double<BR> Dim sysVarName As String<BR> Dim varData As Variant<BR> sysVarName = "DIMLFAC"<BR> varData = ThisDrawing.GetVariable(sysVarName)
returnReal = ThisDrawing.Utility.getreal("请输入偏移距离: ")<BR> Distance = returnReal / varData<BR> offsetObj = ofobject.Offset(Distance)
End Sub 偏移值的正负就控制着方向 参考:
<A href="http://bbs.mjtd.com/forum.php?mod=viewthread&tid=37455" target="_blank" >http://bbs.mjtd.com/forum.php?mod=viewthread&tid=37455</A>
页:
[1]