CAD obtain operating entity (com Interface Web version) click on the left mouse button at

Increase ImplementMouseEventFun incident response function:

document.getElementById("MxDrawXCtrl").ImplementMouseEventFun = MouseEvent;

You can respond to the controls of the left mouse button down event, then we FindEntAtPoint, or MxDrawSelectionSet :: SelectAtPoint function to obtain the mouse coordinates the following entities.

E.g:

// control mouse events        
function MouseEvent (dX, dY, lType) {
 
    // "lType is the event type, a mouse movement, mouse button 2 is pressed, the right mouse button 3 is pressed, a double click .lRet 4 returns non-zero, the message will not be passed down" 
    IF (= lType = 4 )
    {
        // determine whether the selected command is currently running. 
        var RET = mxOcx.Call ( "Mx_IsRuningCommand", "" );
         IF ((ret.AtString (0) == "Ok" )
             ! && ret.AtString (. 1) = "intellisel"
        )
            return;
 
        // left mouse button double-click. 
        // build selection sets, find entities under double-click the left mouse built. 
        var SS =   mxOcx.NewSelectionSet ();
         var filter = mxOcx.NewResbuf ();
         // filter.AddString ( "the LINE", 5020); 
        var Point = mxOcx.NewPoint ();
        point.x = dX;
        point.y = dY;
         // clicked object. 
        ss.SelectAtPoint (Point, filter);
         IF (ss.Count> 0 )
        {
            var ent = ss.Item(0);
            Alert ( "clicked" + ent.ObjectName + "object" );
 
        }
 
        // cancel the back of the command, not the mouse event then passed down. 
        MxOcx.SendStringToExecute ( "" );
         return 1 ;
 
         
    }
    else    if(lType == 3)
    {
        // MessageBox.Show ( "right button"); 
    }
}

 

Guess you like

Origin www.cnblogs.com/yzy0224/p/12016756.html