using sendcommand?

using sendcommand?

Anonymous
Not applicable
600 Views
3 Replies
Message 1 of 4

using sendcommand?

Anonymous
Not applicable
I want to use "bpoly" command via a command bottom, i use this code in click event of command bottom:

userform1.hide
sencommand "bpoly "

it works but when i click the "pick point" bottom on bpoly window the command wil be terminated at all. what can i do?
0 Likes
601 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
VBA has no way of knowing when a command sent to autocad has terminated, so
the program continues right after the dialog closes.

so if you put any lines after the Sendcommand it will execute.

Send command should only be used at last resort (from my point of view!)



a écrit dans le message de news:
[email protected]...
I want to use "bpoly" command via a command bottom, i use this code in click
event of command bottom:

userform1.hide
sencommand "bpoly "

it works but when i click the "pick point" bottom on bpoly window the
command wil be terminated at all. what can i do?
0 Likes
Message 3 of 4

Anonymous
Not applicable
Hi Yves

Thanks for your reply.

So what can I do if:

the program needs an area that should be specify by user by clicking inside a closed area. then the program should define the polygone. the same as what BPOLY does.

do you have any idea what I can do.
0 Likes
Message 4 of 4

Anonymous
Not applicable
I would suggest using the function ThisDrawing.Utility.GetPoint() to prompt the user for a point. Then use that point in conjuction with
sendcommand "-boundary "
to specify the point.
Basically, you need to get all the inputs from the users before you initiate the sendcommand. And you also want to use the command line version of the boundary command (see above) and follow it through to completion before proceding to other VBA codes.

Private Sub btn_Click()
Dim pt
Me.Hide
pt = ThisDrawing.Utility.GetPoint(, "Specify Point...")
ThisDrawing.SendCommand "-boundary "
ThisDrawing.SendCommand pt(0) & "," & pt(1) & " "
' ... Other codes
End Sub
0 Likes