gabep 发表于 2009-2-3 16:19:38

使用ortho获得2个点

您好,
有没有办法使用ThisDrawing.Utility.GetPoint强制用户选择形成水平或垂直矢量的2个点? 就像正交在画线时一样?
谢谢!
   

**** Hidden Message *****

Matt__W 发表于 2009-2-3 16:38:13

是,也不是。
这都是我想出来的,所以不是真的,但应该能让人理解。
sub test()
dim dblPtOne(0 to 2) as double
dim dblPtTwo(0 to 2) as double
dim dblX as double
dim dblY as double
dblptone = thisdrawing.utility.getpoint(,"First point")
dblpttwo = thisdrawing.utility.getpoint(,"Second point")
dblx = dblptone(0) - dblpttwo(0)
if dblx>在这里

Sub grdraw_test()
    Dim pt1, pt2
    Dim VL As Object
    Dim VLF As Object
    Dim VLO As Object
    Dim drawList As String
   
    Set VL = GetInterfaceObject("VL.Application.16") 'or .16 for 2004+
    Set VLF = VL.ActiveDocument.Functions
   
    On Error GoTo Resume_here 'this is just a quick way of handling an "enter to end the point selection process. A more robust handler shoud be used
   
    pt1 = ThisDrawing.Utility.GetPoint(, vbCr & "Start point: ")
    pt2 = ThisDrawing.Utility.GetPoint(pt1, vbCr & "Next point: ")
    drawList = "(grdraw " & pt_list(pt1) & " " & pt_list(pt2) & " 7)"
    Set VLO = VLF.Item("read").funcall(drawList)
    VLF.Item("eval").funcall VLO
    pt1 = pt2
   
Resume_here:
    'do stuff for leader
    Set VLO = VLF.Item("read").funcall("(redraw)")
    VLF.Item("eval").funcall VLO
End Sub
Private Function pt_list(pt) As String
    Dim newStr As String
    newStr = "'(" & pt(0) & " " & pt(1) & ")"
    pt_list = newStr
End Function

Matt__W 发表于 2009-2-3 16:45:02

很酷的炫耀

Swift 发表于 2009-2-3 16:46:00

嫉妒的小婊子!

fixo 发表于 2009-2-3 16:46:58

除了Bob的代码外,您还可以在例程期间打开“ortho”,然后在退出时重置状态。

gabep 发表于 2009-2-3 16:47:13

为实用程序设置位32。初始化输入:
ThisDrawing.Utility.InitializeUserInput 32
p2=ThisDrawing.Utility.GetPoint (p1,"Second point:")
~'J'~

Rogue 发表于 2009-2-3 18:46:58

很棒的东西!
谢谢各位!

Bryco 发表于 2009-2-4 18:26:48

我错过什么了吗?我在做任何工作时看到的仅有两行代码(错误陷阱除外)是
pt1=ThisDrawing.Utility。GetPoint(,vbCr&“起点:”)
pt2=ThisDrawing.Utility。GetPoint(pt1,vbCr&“下一点:”)
我看不到lisp在这里做任何事情

Matt__W 发表于 2009-2-5 18:58:34

天啊,如果凯瑞看到这个。
页: [1]
查看完整版本: 使用ortho获得2个点