Exemplo n.º 1
0
        public void CreateCube()
        {
            //make sure we have a part open
            string partTemplate = iSwApp.GetUserPreferenceStringValue((int)swUserPreferenceStringValue_e.swDefaultTemplatePart);

            if ((partTemplate != null) && (partTemplate != ""))
            {
                IModelDoc2 modDoc = (IModelDoc2)iSwApp.NewDocument(partTemplate, (int)swDwgPaperSizes_e.swDwgPaperA2size, 0.0, 0.0);

                modDoc.InsertSketch2(true);
                modDoc.SketchRectangle(0, 0, 0, .1, .1, .1, false);
                //Extrude the sketch
                IFeatureManager featMan = modDoc.FeatureManager;
                featMan.FeatureExtrusion(true,
                                         false, false,
                                         (int)swEndConditions_e.swEndCondBlind, (int)swEndConditions_e.swEndCondBlind,
                                         0.1, 0.0,
                                         false, false,
                                         false, false,
                                         0.0, 0.0,
                                         false, false,
                                         false, false,
                                         true,
                                         false, false);
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("There is no part template available. Please check your options and make sure there is a part template selected, or select a new part template.");
            }
        }
Exemplo n.º 2
0
        public void OnClose(int reason)
        {
            //This function must contain code, even if it does nothing, to prevent the
            //.NET runtime environment from doing garbage collection at the wrong time.
            int IndentSize;

            IndentSize = System.Diagnostics.Debug.IndentSize;
            System.Diagnostics.Debug.WriteLine(IndentSize);

            if (reason == (int)swPropertyManagerPageCloseReasons_e.swPropertyManagerPageClose_Okay)
            {
                string partTemplate = iSwApp.GetUserPreferenceStringValue((int)swUserPreferenceStringValue_e.swDefaultTemplatePart);
                if ((partTemplate != null) && (partTemplate != ""))
                {
                    swModel = (ModelDoc2)iSwApp.NewDocument(partTemplate, (int)swDwgPaperSizes_e.swDwgPaperA2size, 0.0, 0.0);
                    swModel.InsertSketch2(true);
                    double x = this.activePage.CubeLength / ValueConst.factor;
                    double y = this.activePage.CubeWidth / ValueConst.factor;
                    double z = this.activePage.CubeHeight / ValueConst.factor;
                    swModel.SketchRectangle(0, 0, 0, x, y, 0, false);
                    //Extrude the sketch
                    IFeatureManager featMan   = swModel.FeatureManager;
                    Feature         valuebody = featMan.FeatureExtrusion(true,
                                                                         false, false,
                                                                         (int)swEndConditions_e.swEndCondBlind, (int)swEndConditions_e.swEndCondBlind,
                                                                         z, 0.0,
                                                                         false, false,
                                                                         false, false,
                                                                         0.0, 0.0,
                                                                         false, false,
                                                                         false, false,
                                                                         true,
                                                                         false, false);

                    //修改特征名称为:阀块基体
                    valuebody.Name = "阀块基体";
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("There is no part template available. Please check your options and make sure there is a part template selected, or select a new part template.");
                }
            }
        }
Exemplo n.º 3
0
        public void CreateCube()
        {
            IModelDoc2 modDoc = (IModelDoc2)iSwApp.NewDocument("", (int)swDwgPaperSizes_e.swDwgPaperA2size, 0.0, 0.0);

            modDoc.InsertSketch2(true);
            modDoc.SketchRectangle(0, 0, 0, .1, .1, .1, false);
            //Extrude the sketch
            IFeatureManager featMan = modDoc.FeatureManager;

            featMan.FeatureExtrusion(true,
                                     false, false,
                                     (int)swEndConditions_e.swEndCondBlind, (int)swEndConditions_e.swEndCondBlind,
                                     0.1, 0.0,
                                     false, false,
                                     false, false,
                                     0.0, 0.0,
                                     false, false,
                                     false, false,
                                     true,
                                     false, false);
        }
Exemplo n.º 4
0
        public void CreateCube()
        {
            //make sure we have a part open
            string     partTemplate = iSwApp.GetUserPreferenceStringValue((int)swUserPreferenceStringValue_e.swDefaultTemplatePart);
            IModelDoc2 modDoc       = (IModelDoc2)iSwApp.NewDocument(partTemplate, (int)swDwgPaperSizes_e.swDwgPaperA2size, 0.0, 0.0);

            modDoc.InsertSketch2(true);
            modDoc.SketchRectangle(0, 0, 0, .1, .1, .1, false);
            //Extrude the sketch
            IFeatureManager featMan = modDoc.FeatureManager;

            featMan.FeatureExtrusion(true,
                                     false, false,
                                     (int)swEndConditions_e.swEndCondBlind, (int)swEndConditions_e.swEndCondBlind,
                                     0.1, 0.0,
                                     false, false,
                                     false, false,
                                     0.0, 0.0,
                                     false, false,
                                     false, false,
                                     true,
                                     false, false);
        }