Prevent User Interaction With Model Space

Prevent User Interaction With Model Space

Anonymous
Not applicable
385 Views
4 Replies
Message 1 of 5

Prevent User Interaction With Model Space

Anonymous
Not applicable
Hi,

If a user clicks in Model Space or somehow interfers with AutoCAD while my program is generating lines, block references etc... in Model Space this will cause my program to bomb.

Is there a way to prevent user interaction, like clicking in Model Space while a program is running?

How does anyone else handle users clicking in Model Space while their program is performing an action in Model Space?
0 Likes
386 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Hi scott,

Are you using "SendCommand"?

Clicking in Modelspace is normally ignored while a program is running
unless you code to allow it.

Regards,


Laurie Comerford


scott.ferguson wrote:
> Hi, If a user clicks in Model Space or somehow interfers with AutoCAD
> while my program is generating lines, block references etc... in Model
> Space this will cause my program to bomb. Is there a way to prevent user
> interaction, like clicking in Model Space while a program is running?
> How does anyone else handle users clicking in Model Space while their
> program is performing an action in Model Space?
0 Likes
Message 3 of 5

Anonymous
Not applicable
Hi,

Yes I'm using SendCommand. I'm trying to generate Rubberband lines and unfortunately due to necessary design constraints I'm using COM and SendCommand the only way I know of to generate rubberband lines from the COM API.

ThisDrawing.SendCommand("M" & vbCr & "last" & vbCr & vbCr & insertPnt(0) & "," & insertPnt(1) & vbCr)
0 Likes
Message 4 of 5

Anonymous
Not applicable
Hi Scott,

Straight from the Help files:

Sub Example_GetPoint()
' This example returns a point entered by the user.

Dim returnPnt As Variant

' Return a point using a prompt
returnPnt = ThisDrawing.Utility.GetPoint(, "Enter a point: ")
MsgBox "The WCS of the point is: " & returnPnt(0) & ", " &
returnPnt(1) & ", " & returnPnt(2) & vbCrLf & _
"(Enter the next value without prompting.)", , "GetPoint
Example"

' Return a point, no prompt
returnPnt = ThisDrawing.Utility.GetPoint
MsgBox "The WCS of the point is: " & returnPnt(0) & ", " &
returnPnt(1) & ", " & returnPnt(2), , "GetPoint Example"

' Return a point using a base point and a prompt
Dim basePnt(0 To 2) As Double
basePnt(0) = 2#: basePnt(1) = 2#: basePnt(2) = 0#
returnPnt = ThisDrawing.Utility.GetPoint(basePnt, "Enter a point: ")
MsgBox "The WCS of the point is: " & returnPnt(0) & ", " &
returnPnt(1) & ", " & returnPnt(2)

' Create a line from the base point and the last point entered
Dim lineObj As AcadLine
Set lineObj = ThisDrawing.ModelSpace.AddLine(basePnt, returnPnt)
ZoomAll

End Sub




Regards,


Laurie Comerford
scott.ferguson wrote:
> Hi, Yes I'm using SendCommand. I'm trying to generate Rubberband lines
> and unfortunately due to necessary design constraints I'm using COM and
> SendCommand the only way I know of to generate rubberband lines from the
> COM API. ThisDrawing.SendCommand("M" & vbCr & "last" & vbCr & vbCr &
> insertPnt(0) & "," & insertPnt(1) & vbCr)
0 Likes
Message 5 of 5

Anonymous
Not applicable
Hi Laurie,

I think you misunderstood. I'm using send command to draw a rubberband line, not a line.

"ThisDrawing.SendCommand("M" & vbCr & "last" & vbCr & vbCr &
insertPnt(0) & "," & insertPnt(1) & vbCr)"

You insert an entity in the drawing and run the above command.

By invoking the Move command, then Last then the displayment point, autocad will draw a rubberband line from the displayment point, it is a great visualisation tool for users when you have them create (or select on screen) the other end of a line. They can see where the line is comming from.

I believe the Rubberband Line is exposed in native .net but not using COM.
0 Likes