×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

AutoCAD VBA rubber banding

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

RE: AutoCAD VBA rubber banding

You've already got the code 95% written.. :)

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

(OP)
That's better, but I'm getting a line from the first picked point to the cursor. What I was hoping for is a rectangle like what you get if you invoke the ERASE command.

RE: AutoCAD VBA rubber banding

Ahh... I see what you're trying to do now.

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

(OP)
BEAUTIFUL!! That did it. That's exactly what i want.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close