Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Inputplugin MouseMove makes Measure commands disable

tetsuya_miwa
Advocate
Advocate

Inputplugin MouseMove makes Measure commands disable

tetsuya_miwa
Advocate
Advocate

I have created input plugin which override MouseMove event and it makes all measurement commands not to work even if it does nothing in the code.
Is there a way to skip MouseMove override while measure commad is running?

0 Likes
Reply
Accepted solutions (1)
140 Views
1 Reply
Reply (1)

naveen.kumar.t
Autodesk Support
Autodesk Support
Accepted solution

Hi @tetsuya_miwa ,

 

Could you please take a look at this below code?

[Plugin("MyInputPlugin", "ADSK")]
public class Class1 : InputPlugin
{
    public override bool MouseMove(View view, KeyModifiers modifiers, int x, int y, double timeOffset)
    {
        if (isMeasurementToolRunning())
        {               
            return false;
        }
        else
        {
            //Do What you want to do when the mouse moves
            return true;
        }

      
    }

    private bool isMeasurementToolRunning()
    {
        var activeTool = Autodesk.Navisworks.Api.Application.ActiveDocument.Tool;

        // Define a HashSet of measurement tools for fast lookup
        var measurementTools = new HashSet<Tool>  
        {           
            Tool.MeasureAccumulate,
            Tool.MeasureAngle,
            Tool.MeasureArea,
            Tool.MeasurePointLine,
            Tool.MeasurePointToMultiplePoints,
            Tool.MeasurePointToPoint,
            Tool.MeasureSingle
        };

        // Check if active tool is in the set of measurement tools
        return activeTool != null && measurementTools.Contains(activeTool);
    }
}

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network