////////////////////////////////////////////////////////////////////////////////////////////// // // ////////////////////////////////////////////////////////////////////////////////////////////// void MouseEvents_OnMouseDown( MouseButtonEnum Button, ShiftStateEnum ShiftKeys, Inventor.Point ModelPosition, Point2d ViewPosition, Inventor.View View) { if (Button != MouseButtonEnum.kLeftMouseButton) { return; } InsertAsSurfaceGraphics(_compGraph.Parent.Transformation); _clientGraphicsMng.SetGraphicsSource( _interactionManager.InteractionEvents); ComponentDefinition compDef = AdnInventorUtilities.GetCompDefinition(_componentDocument); _compGraph = _clientGraphicsMng.DrawComponent(compDef); }
void DoDemo() { Inventor.Application InvApp = AdnInventorUtilities.InvApplication; string filename = AdnInventorUtilities.ShowOpenDialog( "Select Inventor file", "Inventor Files (*.ipt; *.iam)|*.ipt;*.iam"); if (filename == string.Empty) { return; } _componentDocument = InvApp.Documents.Open(filename, false); ComponentDefinition compDef = AdnInventorUtilities.GetCompDefinition(_componentDocument); _interactionManager = new AdnInteractionManager(InvApp); _interactionManager.Initialize(); _interactionManager.OnTerminateEvent += new AdnInteractionManager.OnTerminateHandler(OnTerminateEvent); _interactionManager.MouseEvents.MouseMoveEnabled = true; _interactionManager.MouseEvents.OnMouseDown += new MouseEventsSink_OnMouseDownEventHandler(MouseEvents_OnMouseDown); _interactionManager.MouseEvents.OnMouseMove += new MouseEventsSink_OnMouseMoveEventHandler(MouseEvents_OnMouseMove); _interactionManager.Start("Place Component: "); _clientGraphicsMng = new AdnClientGraphicsManager( AdnInventorUtilities.InvApplication, AdnInventorUtilities.AddInGuid); _clientGraphicsMng.SetGraphicsSource( _interactionManager.InteractionEvents); _compGraph = _clientGraphicsMng.DrawComponent(compDef); }