예제 #1
0
        void DoDemo()
        {
            Inventor.Application InvApp = AdnInventorUtilities.InvApplication;

            _interactionManager = new AdnInteractionManager(InvApp);

            _interactionManager.Initialize();

            _interactionManager.SelectEvents.SingleSelectEnabled = true;

            _interactionManager.OnTerminateEvent +=
                new AdnInteractionManager.OnTerminateHandler(OnTerminateEvent);

            _interactionManager.SelectEvents.OnSelect +=
                new SelectEventsSink_OnSelectEventHandler(SelectEvents_OnSelect);

            _interactionManager.AddSelectionFilter(SelectionFilterEnum.kPartFacePlanarFilter);
            _interactionManager.AddSelectionFilter(SelectionFilterEnum.kWorkPlaneFilter);

            _interactionManager.Start("Select workplane/planar face: ");

            _clientGraphicsMng = new AdnClientGraphicsManager(
                AdnInventorUtilities.InvApplication,
                AdnInventorUtilities.AddInGuid);

            _clientGraphicsMng.SetGraphicsSource(
                _interactionManager.InteractionEvents);

            _curveGraph = null;

            _mode = SelectModeEnum.kPlaneSelect;
        }
        void DoDemo()
        {
            Inventor.Application InvApp = AdnInventorUtilities.InvApplication;

            _compDef = AdnInventorUtilities.GetCompDefinition(InvApp.ActiveDocument);

            _surfaceBodies = AdnInventorUtilities.GetTransientBodies(_compDef);

            _interactionManager = new AdnInteractionManager(InvApp);

            _interactionManager.Initialize();

            _interactionManager.OnTerminateEvent +=
                new AdnInteractionManager.OnTerminateHandler(OnTerminateEvent);

            _clientGraphicsMng = new AdnClientGraphicsManager(
                InvApp,
                AdnInventorUtilities.AddInGuid);

            _clientGraphicsMng.SetGraphicsSource(_interactionManager.InteractionEvents);


            _interactionManager.SelectEvents.SingleSelectEnabled = true;

            _interactionManager.AddSelectionFilter(SelectionFilterEnum.kPartFacePlanarFilter);
            _interactionManager.AddSelectionFilter(SelectionFilterEnum.kWorkPlaneFilter);

            _interactionManager.SelectEvents.OnSelect +=
                new SelectEventsSink_OnSelectEventHandler(SelectEvents_OnSelect);

            _interactionManager.Start("Select planar face or workplane: ");
        }
예제 #3
0
        //////////////////////////////////////////////////////////////////////////////////////////////
        //
        //
        //////////////////////////////////////////////////////////////////////////////////////////////
        void SelectEvents_OnSelect(
            ObjectsEnumerator JustSelectedEntities,
            SelectionDeviceEnum SelectionDevice,
            Point ModelPosition,
            Point2d ViewPosition,
            View View)
        {
            switch (_mode)
            {
            case SelectModeEnum.kPlaneSelect:
            {
                _plane = AdnInventorUtilities.GetPlane(JustSelectedEntities[1]);

                _interactionManager.MouseEvents.MouseMoveEnabled = true;

                _interactionManager.ClearSelectionFilters();

                _interactionManager.AddSelectionFilter(SelectionFilterEnum.kPartVertexFilter);
                _interactionManager.AddSelectionFilter(SelectionFilterEnum.kWorkPointFilter);

                _interactionManager.InteractionEvents.StatusBarText = "Select center: ";

                _mode = SelectModeEnum.kCenterSelect;

                break;
            }

            case SelectModeEnum.kCenterSelect:
            {
                _center = AdnInventorUtilities.GetPoint(JustSelectedEntities[1]);

                Circle circle = AdnInventorUtilities.InvApplication.TransientGeometry.CreateCircle(
                    _center,
                    _plane.Normal,
                    0.001);

                _curveGraph = _clientGraphicsMng.DrawCurve(circle);

                _curveGraph.LineWeight = 0.5;

                _interactionManager.InteractionEvents.StatusBarText = "Select radius: ";

                _interactionManager.MouseEvents.OnMouseMove +=
                    new MouseEventsSink_OnMouseMoveEventHandler(MouseEvents_OnMouseMove);

                _interactionManager.SelectEvents.OnSelect -=
                    new SelectEventsSink_OnSelectEventHandler(SelectEvents_OnSelect);

                _mode = SelectModeEnum.kRadiusSelect;

                break;
            }

            default:
                break;
            }
        }