Community
Hi Guys,
I have a function add line to drawing based on points user clicked. It doesn't seem to catch right click. I wonder what could I do to make the code detect right click?
Any ideas?
Thanks
Here is the code
Imports Autodesk.AutoCAD.ApplicationServices Imports Autodesk.AutoCAD.DatabaseServices Imports Autodesk.AutoCAD.EditorInput Imports Autodesk.AutoCAD.Geometry Imports Autodesk.AutoCAD.Runtime <CommandMethod("GetPointsFromUser")> _ Public Sub GetPointsFromUser() '' Get the current database and start the Transaction Manager Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument Dim acCurDb As Database = acDoc.Database Dim pPtRes As PromptPointResult Dim pPtOpts As PromptPointOptions = New PromptPointOptions("") '' Prompt for the start point pPtOpts.Message = vbLf & "Enter the start point of the line: " pPtRes = acDoc.Editor.GetPoint(pPtOpts) Dim ptStart As Point3d = pPtRes.Value '' Exit if the user presses ESC or cancels the command If pPtRes.Status = PromptStatus.Cancel Then Exit Sub '' Prompt for the end point pPtOpts.Message = vbLf & "Enter the end point of the line: " pPtOpts.UseBasePoint = True pPtOpts.BasePoint = ptStart pPtRes = acDoc.Editor.GetPoint(pPtOpts) Dim ptEnd As Point3d = pPtRes.Value If pPtRes.Status = PromptStatus.Cancel Then Exit Sub '' Start a transaction Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction() Dim acBlkTbl As BlockTable Dim acBlkTblRec As BlockTableRecord '' Open Model space for write acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, _ OpenMode.ForRead) acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), _ OpenMode.ForWrite) '' Define the new line Dim acLine As Line = New Line(ptStart, ptEnd) acLine.SetDatabaseDefaults() '' Add the line to the drawing acBlkTblRec.AppendEntity(acLine) acTrans.AddNewlyCreatedDBObject(acLine, True) '' Zoom to the extents or limits of the drawing acDoc.SendStringToExecute("._zoom _all ", True, False, False) '' Commit the changes and dispose of the transaction acTrans.Commit() End Using End Sub
As Tony mentioned
http://forums.autodesk.com/t5/NET/capture-right-click-in-getpoint/m-p/2595514/highlight/true#M16808
pPtOpts.AllowNone = True