コード例 #1
0
        public void TranslateT2C(TransCAD.IPart tPart)
        {
            //IEnumerator tFeatureList = tPart.Features.GetEnumerator();
            TransCAD.Features tFeatures = tPart.Features;


            //TransCAD.IFeature tFeature = (TransCAD.IFeature)tFeatureList.Current;

            for (int i = 1; i <= tFeatures.Count; i++)
            {
                TransCAD.IFeature tFeature = (TransCAD.IFeature)tFeatures[i];
                try
                {
                    Feature pFeature = null;

                    if (tFeature.Type == TransCAD.FeatureType.StdSolidProtrusionExtrudeFeature)
                    {
                        pFeature = new FeaturePad(this);
                    }
                    else if (tFeature.Type == TransCAD.FeatureType.StdSolidCutExtrudeFeature)
                    {
                        pFeature = new FeaturePocket(this);
                    }
                    else if (tFeature.Type == TransCAD.FeatureType.StdSolidFilletConstantFeature)
                    {
                        pFeature = new FeatureEdgeFillet(this);
                    }
                    else if (tFeature.Type == TransCAD.FeatureType.StdSolidProtrusionSweepFeature)
                    {
                        pFeature = new FeatureRib(this);
                    }
                    else if (tFeature.Type == TransCAD.FeatureType.StdSolidCutSweepFeature)
                    {
                        pFeature = new FeatureSlot(this);
                    }
                    else if (tFeature.Type == TransCAD.FeatureType.StdSolidProtrusionRevolveFeature)
                    {
                        pFeature = new FeatureShaft(this);
                    }
                    else if (tFeature.Type == TransCAD.FeatureType.StdSolidChamferFeature)
                    {
                        pFeature = new FeatureChamfer(this);
                    }
                    else if (tFeature.Type == TransCAD.FeatureType.StdSolidCutRevolveFeature)
                    {
                        pFeature = new FeatureGroove(this);
                    }
                    else if (tFeature.Type == TransCAD.FeatureType.StdSolidOperatePatternRectangularFeature)
                    {
                        pFeature = new FeatureRectPattern(this);
                    }
                    else if (tFeature.Type == TransCAD.FeatureType.StdSolidOperatePatternCircularFeature)
                    {
                        pFeature = new FeatureCircPattern(this);
                    }
                    else if (tFeature.Type == TransCAD.FeatureType.StdSolidHoleCounterboredFeature ||
                             tFeature.Type == TransCAD.FeatureType.StdSolidHoleCountersunkFeature ||
                             tFeature.Type == TransCAD.FeatureType.StdSolidHoleSimpleFeature)
                    {
                        pFeature = new FeatureHole(this);
                    }

                    if (pFeature != null)
                    {
                        pFeature.TranslateT2C(tFeature);
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show("-Feature Name: " + tFeature.Name + "\n-Error Message: " + e.Message, "Failed to create a feature!");
                }

                cPart.Update(); // CATIA Part 업데이트
            }
        }
コード例 #2
0
        public void TranslateC2T() // From CATIA to TransCAD
        {
            IEnumerator cFeatureList = cShapes.GetEnumerator();

            while (cFeatureList.MoveNext())
            {
                MECMOD.Shape cShape = (MECMOD.Shape)cFeatureList.Current;

                if (cShape == null)
                {
                    // Sketch 혹은 DatumPlane만 있는 경우
                }
                else
                {
                    string cFeatureName = cShape.get_Name();

                    try
                    {
                        Feature pFeature = null;

                        if (cFeatureName.Contains("Pad"))
                        {
                            pFeature = new FeaturePad(this);
                        }
                        else if (cFeatureName.Contains("Pocket"))
                        {
                            pFeature = new FeaturePocket(this);
                        }
                        else if (cFeatureName.Contains("EdgeFillet"))
                        {
                            pFeature = new FeatureEdgeFillet(this);
                        }
                        else if (cFeatureName.Contains("Rib"))
                        {
                            pFeature = new FeatureRib(this);
                        }
                        else if (cFeatureName.Contains("Slot"))
                        {
                            pFeature = new FeatureSlot(this);
                        }
                        else if (cFeatureName.Contains("Shaft"))
                        {
                            pFeature = new FeatureShaft(this);
                        }
                        else if (cFeatureName.Contains("Chamfer"))
                        {
                            pFeature = new FeatureChamfer(this);
                        }
                        else if (cFeatureName.Contains("Groove"))
                        {
                            pFeature = new FeatureGroove(this);
                        }
                        else if (cFeatureName.Contains("RectPattern"))
                        {
                            pFeature = new FeatureRectPattern(this);
                        }
                        else if (cFeatureName.Contains("CircPattern"))
                        {
                            pFeature = new FeatureCircPattern(this);
                        }
                        else if (cFeatureName.Contains("Hole"))
                        {
                            pFeature = new FeatureHole(this);
                        }

                        if (pFeature != null)
                        {
                            pFeature.TranslateC2T(cShape);
                        }
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show("-Feature Name: " + cFeatureName + "\n-Error Message: " + e.Message, "Failed to create a feature!");
                    }
                }
            }
        }