Hi folks,
I am missing something here. I want to prompt the user to click on a line in 2 different places and collect both datapoints.
If I click on text for the first datapoint it correctly says its not a line, however for the second datapoint I can click on anything and it accepts it... help!
sub main()
CommandState.StartLocate New clsLocatePts
end sub
' ---------------------------class code ---------------------------------------
Option ExplicitImplements ILocateCommandEvents
Dim Mypoint(1) As Point3d ' holds the data point user providesDim numPointsPlaced As Long ' number of datapoints placed
Private Sub ILocateCommandEvents_Start() Application.ShowCommand "" Application.ShowPrompt "Select first point on line, RESET to exit" numPointsPlaced = 0End Sub
Private Sub ILocateCommandEvents_Accept(ByVal Element As Element, Point As Point3d, ByVal view As view)On Error GoTo err If numPointsPlaced = 0 Then CommandState.StartDynamics Mypoint(0) = Point ' capture first point MsgBox "Point 1 captured" Application.ShowPrompt "Select Second Point on line, RESET to restart" Else CommandState.SetLocateCursor MsgBox "Point 2 captured" Mypoint(1) = Point ' capture second point
' have 2 points time for H/W calc MsgBox "time to calc"
CommandState.StartDefaultCommand numPointsPlaced = 0 Exit Sub End If
numPointsPlaced = numPointsPlaced + 1 Exit Suberr: MsgBox "Datapoint module error " & err.Number & vbCrLf & err.DescriptionEnd Sub
Private Sub ILocateCommandEvents_LocateFilter(ByVal Element As Element, Point As Point3d, Accepted As Boolean)
' add in line string later
If Element.Type = msdElementTypeLine Then Accepted = True Else Accepted = False End If
End Sub
Private Sub ILocateCommandEvents_LocateFailed()' ShowStatus "Not a line element"MsgBox "Not a line element"End Sub
Private Sub ILocateCommandEvents_Dynamics(Point As Point3d, ByVal view As view, ByVal DrawMode As MsdDrawingMode)
Private Sub ILocateCommandEvents_LocateReset() '????End Sub
Private Sub ILocateCommandEvents_Cleanup()