コード例 #1
0
        //////////////////////////////////////////////////////////////////////////////////////////////
        // Insert Component as ComponentGraphics
        //
        //////////////////////////////////////////////////////////////////////////////////////////////
        void InsertAsComponentGraphics(Matrix transfo)
        {
            Inventor.Application InvApp = AdnInventorUtilities.InvApplication;

            _clientGraphicsMng.SetGraphicsSource(InvApp.ActiveDocument);

            ComponentDefinition compDef =
                AdnInventorUtilities.GetCompDefinition(_componentDocument);

            _compGraph = _clientGraphicsMng.DrawComponent(compDef);

            _compGraph.Parent.Transformation = transfo;
            _compGraph.Parent.Selectable     = true;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        //////////////////////////////////////////////////////////////////////////////////////////////
        //
        //
        //////////////////////////////////////////////////////////////////////////////////////////////
        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);
        }
        public ComponentGraphics DrawComponent(
            ComponentDefinition compDef,
            GraphicsNode node)
        {
            try
            {
                AdnGraphics graphicsData = WorkingGraphics;

                if (node == null)
                {
                    node = graphicsData.ClientGraphics.AddNode(
                        graphicsData.GetGraphicNodeFreeId());
                }

                ComponentGraphics graphic = node.AddComponentGraphics(compDef);

                return(graphic);
            }
            catch
            {
                return(null);
            }
        }
コード例 #5
0
ファイル: Component.cs プロジェクト: derzzle/INV2016_TRN
        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);
        }
コード例 #6
0
ファイル: Component.cs プロジェクト: derzzle/INV2016_TRN
        //////////////////////////////////////////////////////////////////////////////////////////////
        // Insert Component as ComponentGraphics
        //
        //////////////////////////////////////////////////////////////////////////////////////////////
        void InsertAsComponentGraphics(Matrix transfo)
        {
            Inventor.Application InvApp = AdnInventorUtilities.InvApplication;

            _clientGraphicsMng.SetGraphicsSource(InvApp.ActiveDocument);

            ComponentDefinition compDef =
               AdnInventorUtilities.GetCompDefinition(_componentDocument);

            _compGraph = _clientGraphicsMng.DrawComponent(compDef);

            _compGraph.Parent.Transformation = transfo;
            _compGraph.Parent.Selectable = true;
        }
コード例 #7
0
ファイル: Component.cs プロジェクト: derzzle/INV2016_TRN
        //////////////////////////////////////////////////////////////////////////////////////////////
        // 
        //
        //////////////////////////////////////////////////////////////////////////////////////////////
        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);
        }