コード例 #1
0
        public MyBalloon(Inventor.Document oDoc)
        {
            if (oDoc.DocumentType == DocumentTypeEnum.kDrawingDocumentObject && InvDoc.u.referendedDoc(oDoc).DocumentType == DocumentTypeEnum.kAssemblyDocumentObject)
            {
                m_DrwDoc  = (Inventor.DrawingDocument)oDoc;
                m_AsmDoc  = (Inventor.AssemblyDocument)InvDoc.u.referendedDoc(oDoc);
                invApp    = (Inventor.Application)oDoc.Parent;
                cmdMgr    = invApp.CommandManager;
                interEvts = cmdMgr.CreateInteractionEvents();
                selEvts   = interEvts.SelectEvents;
                selEvts.AddSelectionFilter(SelectionFilterEnum.kDrawingCurveSegmentFilter);
                selEvts.SingleSelectEnabled = true;
                selEvts.OnSelect           += new SelectEventsSink_OnSelectEventHandler(selectEvts);
                mouseEvts = interEvts.MouseEvents;
                mouseEvts.MouseMoveEnabled = true;
                mouseEvts.OnMouseClick    += new MouseEventsSink_OnMouseClickEventHandler(mouseClick);
                mouseEvts.OnMouseMove     += new MouseEventsSink_OnMouseMoveEventHandler(mouseMove);
                objs = invApp.TransientObjects.CreateObjectCollection();

                interEvts.StatusBarText = "Первая точка выноски:";
                interEvts.Start();
                //dcs = (Inventor.DrawingCurveSegment)cmdMgr.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Выберите компонент:");

                //m_Type = obj.GetType();
                //compOcc = (ComponentOccurrence)m_Type.GetProperty("ContainingOccurrence");

                //interEvts.InteractionGraphics;
                //if (obj.
                //    dcs.Parent.ModelGeometry.GetType() == Inventor.ObjectTypeEnum.kEdgeProxyObject)
                //{

                //}
            }
        }
コード例 #2
0
 private void OnPreSelect(ref object PreSelectEntity, out bool DoHighlight, ref Inventor.ObjectCollection MorePreSelectEntities, Inventor.SelectionDeviceEnum SelectionDevice, Inventor.Point ModelPosition, Inventor.Point2d ViewPosition, Inventor.View View)
 {
     if (PreSelectEntity is SurfaceGraphicsFace)
     {
         DoHighlight = true;
     }
     else
     {
         DoHighlight = false;
     }
 }
コード例 #3
0
ファイル: Form1.cs プロジェクト: ferdiansyahz/Archie_
        private void Feature5(int x, int y)
        {
            try
            {
                PartDocument oPartDoc = (PartDocument)_invApp.ActiveDocument;
                oPartDoc.UnitsOfMeasure.LengthUnits = Inventor.UnitsTypeEnum.kMillimeterLengthUnits;
                PartComponentDefinition oCompDef = default(PartComponentDefinition);
                oCompDef = oPartDoc.ComponentDefinition;
                Inventor.ObjectCollection objCol = default(Inventor.ObjectCollection);
                objCol = _invApp.TransientObjects.CreateObjectCollection();
                objCol.Add(oCompDef.Features[4]);
                oCompDef.Features.CircularPatternFeatures.Add(ParentFeatures: objCol, AxisEntity: oCompDef.WorkAxes[3], NaturalAxisDirection: true, Count: 6, Angle: 360 * 0.0174532925, FitWithinAngle: true, ComputeType: Inventor.PatternComputeTypeEnum.kIdenticalCompute);

                serial1.Close();
                pictureBox2.Enabled = false;
                label2.Enabled      = false;
                pictureBox1.Enabled = true;
                label1.Enabled      = true;

                MessageBox.Show(this,
                                "Good job! Your design is finished",
                                "Finish",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            catch
            {
                try
                {
                    Feature4(x, y);
                }
                catch
                {
                    try
                    {
                        Feature3(x, y);
                    }
                    catch
                    {
                        Feature2(x, y);
                    }
                }
            }
        }
コード例 #4
0
        private void m_BrowserEvents_OnBrowserNodeGetDisplayObjects(object BrowserNodeDefinition, ref Inventor.ObjectCollection Objects, Inventor.NameValueMap Context, ref Inventor.HandlingCodeEnum HandlingCode)
        {
            PartDocument            oPartDocument = m_inventorApplication.ActiveDocument as PartDocument;
            PartComponentDefinition oPartDef      = oPartDocument.ComponentDefinition;

            if (oHighlight == null)
            {
                oHighlight = oPartDocument.CreateHighlightSet();
            }
            else
            {
                oHighlight.Clear();
            }

            Inventor.Color oColor = default(Inventor.Color);
            oColor = m_inventorApplication.TransientObjects.CreateColor(128, 22, 22);

            // Set the opacity
            oColor.Opacity   = 0.8;
            oHighlight.Color = oColor;

            if (BrowserNodeDefinition is ClientBrowserNodeDefinition)
            {
                ClientBrowserNodeDefinition oClientB = (ClientBrowserNodeDefinition)BrowserNodeDefinition;
                //highlight all ExtrudeFeature
                if (oClientB.Label == "Node2")
                {
                    foreach (ExtrudeFeature oExtrudeF in oPartDef.Features.ExtrudeFeatures)
                    {
                        oHighlight.AddItem(oExtrudeF);
                    }
                    //highlight all RevolveFeature
                }
                else if (oClientB.Label == "Node3")
                {
                    foreach (RevolveFeature oRevolveF in oPartDef.Features.RevolveFeatures)
                    {
                        oHighlight.AddItem(oRevolveF);
                    }
                }
            }
        }