Exemplo n.º 1
0
        public INFITF.AnyObject GetRecentFeature()
        {
            // 가장 최근 생성된 특징형상 리턴
            MECMOD.Shape cShape = cShapes.Item(cShapes.Count - 1);

            if (cShape.get_Name().Contains("Pad"))
            {
                return((PARTITF.Pad)cShape);
            }
            else if (cShape.get_Name().Contains("Pocket"))
            {
                return((PARTITF.Pocket)cShape);
            }
            else if (cShape.get_Name().Contains("EdgeFillet"))
            {
                return((PARTITF.ConstRadEdgeFillet)cShape);
            }
            else if (cShape.get_Name().Contains("Chamfer"))
            {
                return((PARTITF.Chamfer)cShape);
            }
            else if (cShape.get_Name().Contains("Shaft"))
            {
                return((PARTITF.Shaft)cShape);
            }
            else if (cShape.get_Name().Contains("Groove"))
            {
                return((PARTITF.Groove)cShape);
            }
            else if (cShape.get_Name().Contains("Rib"))
            {
                return((PARTITF.Rib)cShape);
            }
            else if (cShape.get_Name().Contains("Slot"))
            {
                return((PARTITF.Slot)cShape);
            }
            else if (cShape.get_Name().Contains("Hole"))
            {
                return((PARTITF.Hole)cShape);
            }
            else if (cShape.get_Name().Contains("RectPattern"))
            {
                return((PARTITF.RectPattern)cShape);
            }
            else if (cShape.get_Name().Contains("CircPattern"))
            {
                return((PARTITF.CircPattern)cShape);
            }

            return(null);
        }
Exemplo n.º 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!");
                    }
                }
            }
        }