AutoCAD VBA rubber banding
AutoCAD VBA rubber banding
(OP)
In a VBA program when I have the user select an area on the screen, I call the GetUserPoint twice (to get both points) and then call the SelectByPoints sub. Doing this, the user does not have rubber banding as they move the mouse from their first selection point to the second. It seems as if it's not working for the user if they don't see the familar rubber banding. How do I get the rubber banding outline to show up? My code is shown below.
Public Sub GetUserPoint()
PointPicked = True
With ThisDrawing.Utility
On Error GoTo NoInput
varPick = .GetPoint(, vbCr & "Pick a point: ")
.Prompt vbCr & varPick(0) & "," & varPick(1)
On Error GoTo NoInput
End With
Exit Sub
NoInput:
PointPicked = False
End Sub
and
Public Sub SelectByPoints()
On Error Resume Next
ThisDrawing.SelectionSets("TEMP").Delete
Set objSS = ThisDrawing.SelectionSets.Add("TEMP")
''''objSS.Select 1, Pt1, Pt2, intCodes, varCodeValues ' 5 = all, 1 = use Pt1 and Pt2
objSS.Select 1, Pt1, Pt2
End Sub
Public Sub GetUserPoint()
PointPicked = True
With ThisDrawing.Utility
On Error GoTo NoInput
varPick = .GetPoint(, vbCr & "Pick a point: ")
.Prompt vbCr & varPick(0) & "," & varPick(1)
On Error GoTo NoInput
End With
Exit Sub
NoInput:
PointPicked = False
End Sub
and
Public Sub SelectByPoints()
On Error Resume Next
ThisDrawing.SelectionSets("TEMP").Delete
Set objSS = ThisDrawing.SelectionSets.Add("TEMP")
''''objSS.Select 1, Pt1, Pt2, intCodes, varCodeValues ' 5 = all, 1 = use Pt1 and Pt2
objSS.Select 1, Pt1, Pt2
End Sub





RE: AutoCAD VBA rubber banding
All you have to do is use Pt1 in a second .getpoint statement, you've been passing the option by..
Pt2 = .GetPoint(Pt1, vbCr & "Pick second point: ")
Tim Grote - The Irrigation Engineers.
www.irrigationengineers.com
RE: AutoCAD VBA rubber banding
RE: AutoCAD VBA rubber banding
What might be handy for you is to let the user select however they like. That method is simply (.selectonscreen) you user will then be able to select individual entities, or window, or window polygon, etc. You can even apply filters if you like. It looks something like this:
'==============================================================================
'Return a selectionset of Sprinklers
'==============================================================================
Public Function GetSprinklers() As AcadSelectionSet
Dim objSetSprinklers As AcadSelectionSet
Dim GroupCode(0 To 1) As Integer
Dim DataValue(0 To 1) As Variant
Dim FilterType As Variant
Dim FilterData As Variant
'------------------------------------------------------
Set objSetSprinklers = MakeSelectionSet("02810sprinklerss")
GroupCode(0) = 0: DataValue(0) = "Insert"
GroupCode(1) = 8: DataValue(1) = "02810-sprinkler"
FilterType = GroupCode: FilterData = DataValue
ThisDrawing.Utility.Prompt "Select Sprinklers:"
objSetSprinklers.SelectOnScreen FilterType, FilterData
Set GetSprinklers = objSetSprinklers
End Function
Tim Grote - The Irrigation Engineers.
www.irrigationengineers.com
RE: AutoCAD VBA rubber banding