private void getInsertFace(PartComponentDefinition oPartCompDef)
        {
            switch (m_insertPlane)
            {
            case 1:
                m_insertFace = oPartCompDef.Features.ExtrudeFeatures["拉伸1"].Faces[5];
                break;

            case 2:
                m_insertFace = oPartCompDef.Features.ExtrudeFeatures["拉伸1"].Faces[4];
                break;

            case 3:
                m_insertFace = oPartCompDef.Features.ExtrudeFeatures["拉伸1"].Faces[3];
                break;

            case 4:
                m_insertFace = oPartCompDef.Features.ExtrudeFeatures["拉伸1"].Faces[2];
                break;

            case 5:
                m_insertFace = oPartCompDef.Features.ExtrudeFeatures["拉伸1"].Faces[1];
                break;

            case 6:
                m_insertFace = oPartCompDef.Features.ExtrudeFeatures["拉伸1"].Faces[6];
                break;
            }
        }
예제 #2
0
        public void selOp(ref List <Edge> edgeCmp)
        {
            CommandManager cmdMgr = Macros.StandardAddInServer.m_inventorApplication.CommandManager;

            //input = cmdMgr.UserInputEvents;
            try
            {
                intEvts = cmdMgr.CreateInteractionEvents();
                intEvts.InteractionDisabled = false;
                sel = intEvts.SelectEvents;
                sel.WindowSelectEnabled = true;
                sel.AddSelectionFilter(SelectionFilterEnum.kPartEdgeCircularFilter);
                sel.OnSelect   += new SelectEventsSink_OnSelectEventHandler(select);
                key             = intEvts.KeyboardEvents;
                key.OnKeyPress += new KeyboardEventsSink_OnKeyPressEventHandler(keyOp);
                intEvts.Start();
                intEvts.StatusBarText = "Выберите отверстия:";
                //input.OnSelect += new UserInputEventsSink_OnSelectEventHandler(select);
                //face = (Face)cmdMgr.Pick(SelectionFilterEnum.kPartFaceFilter, "Выберите поверхность:");

                flag = true;
                while (flag)
                {
                    Macros.StandardAddInServer.m_inventorApplication.UserInterfaceManager.DoEvents();
                }

                for (int i = 0; i < sel.SelectedEntities.Count; i++)
                {
                    try
                    {
                        Edge          ed = (Edge)sel.SelectedEntities[i + 1];
                        Inventor.Face f  = (ed.Faces[1].SurfaceType == SurfaceTypeEnum.kCylinderSurface) ? ed.Faces[1] : ed.Faces[2];
                        edgeCmp.Add(ed);
                        //ed = (f.Edges[1].Equals(ed)) ? f.Edges[2] : f.Edges[1];
                        //edgeCmp1.Add(ed);
                    }
                    catch (Exception) { }
                }

                intEvts.Stop();

                sel.OnSelect   -= new SelectEventsSink_OnSelectEventHandler(select);
                key.OnKeyPress -= new KeyboardEventsSink_OnKeyPressEventHandler(keyOp);
                sel             = null;
                key             = null;
                intEvts         = null;
            }
            catch (Exception)
            {
                sel     = null;
                key     = null;
                intEvts = null;
            }
        }
예제 #3
0
 private void keyOp(int KeyASCII)
 {
     if (KeyASCII == 32)
     {
         Edge          ed = (Edge)sel.SelectedEntities[sel.SelectedEntities.Count];
         double        r  = ((Circle)ed.Geometry).Radius;
         Inventor.Face f  = (ed.Faces[1].SurfaceType == SurfaceTypeEnum.kPlaneSurface) ? ed.Faces[1] : ed.Faces[2];
         foreach (Edge e in f.Edges)
         {
             if (e.GeometryType == CurveTypeEnum.kCircleCurve && ((Circle)e.Geometry).Radius == r)
             {
                 sel.AddToSelectedEntities(e);
             }
         }
     }
     else if (KeyASCII == 13)
     {
         flag = false;
     }
 }