예제 #1
0
        // Pre
        public override void TranslateC2T(MECMOD.Shape cShape)
        {
            PARTITF.RectPattern cRectPattern = (PARTITF.RectPattern)cShape;

            object[] firstDir  = new object[3];
            object[] secondDir = new object[3];

            GetDirections(cRectPattern, firstDir, secondDir);

            int    firstCount   = cRectPattern.FirstDirectionRepartition.InstancesCount.Value;
            double firstSpacing = Math.Abs(cRectPattern.FirstDirectionRepartition.Spacing.Value);

            int    secondCount   = cRectPattern.SecondDirectionRepartition.InstancesCount.Value;
            double secondSpacing = Math.Abs(cRectPattern.SecondDirectionRepartition.Spacing.Value);

            TransCAD.References refElements = PartManager.tPart.CreateReferences();
            TransCAD.Reference  refElement  = PartManager.tPart.SelectFeatureByName(cRectPattern.ItemToCopy.get_Name());

            if (refElement != null)
            {
                refElements.Add(refElement);
            }

            PartManager.tFeatures.AddNewSolidOperatePatternRectangularFeature(cRectPattern.get_Name(), refElements, firstSpacing, (double)firstDir[0], (double)firstDir[1], (double)firstDir[2],
                                                                              firstCount, secondSpacing, (double)secondDir[0], (double)secondDir[1], (double)secondDir[2], secondCount);
        }
예제 #2
0
        // Pre
        public override void TranslateC2T(MECMOD.Shape cShape)
        {
            PARTITF.CircPattern cCircPattern = (PARTITF.CircPattern)cShape;

            object[] center = new object[3];
            object[] axis   = new object[3];

            cCircPattern.GetRotationCenter(center);
            cCircPattern.GetRotationAxis(axis);

            int    angularCount   = cCircPattern.AngularRepartition.InstancesCount.Value;
            double angularSpacing = cCircPattern.AngularRepartition.AngularSpacing.Value;

            int    radialCount   = cCircPattern.RadialRepartition.InstancesCount.Value;
            double radialSpacing = cCircPattern.RadialRepartition.Spacing.Value;

            bool isRadiallyAligned = cCircPattern.RadialAlignment;

            TransCAD.References refElements = PartManager.tPart.CreateReferences();
            TransCAD.Reference  refElement  = PartManager.tPart.SelectFeatureByName(cCircPattern.ItemToCopy.get_Name());

            if (refElement != null)
            {
                refElements.Add(refElement);
            }

            PartManager.tFeatures.AddNewSolidOperatePatternCircularFeature(cCircPattern.get_Name(), refElements, (double)center[0], (double)center[1], (double)center[2],
                                                                           (double)axis[0], (double)axis[1], (double)axis[2], angularCount, angularSpacing, radialCount, radialSpacing, isRadiallyAligned);
        }
        // Pre
        public override void TranslateC2T(MECMOD.Shape cShape)
        {
            PARTITF.ConstRadEdgeFillet cFillet = (PARTITF.ConstRadEdgeFillet)cShape;

            double radius = cFillet.Radius.Value;

            TransCAD.PropagationType propagation = TransCAD.PropagationType.Tangency;

            if (cFillet.EdgePropagation == PARTITF.CatFilletEdgePropagation.catMinimalFilletEdgePropagation)
            {
                propagation = TransCAD.PropagationType.Minimal;
            }

            TransCAD.References refElements = PartManager.tPart.CreateReferences();

            for (int i = 1; i <= cFillet.ObjectsToFillet.Count; i++)
            {
                string elementName = cFillet.ObjectsToFillet.Item(i).DisplayName;
                elementName = PartManager.ReferenceManager.GetTransCADNameFromCATIAName(elementName);

                TransCAD.Reference refElement = PartManager.tPart.SelectBrepByName(elementName);

                refElements.Add(refElement);
            }

            PartManager.tFeatures.AddNewSolidFilletConstantFeature(cFillet.get_Name(), refElements, radius, propagation);
        }
예제 #4
0
        private INFITF.Reference GetTargetFace(string tFaceName)
        {
            string targetFeatureName = tFaceName.Remove(tFaceName.IndexOf(","));

            MECMOD.Shape targetFeature = PartManager.cShapes.Item(PartManager.ReferenceManager.NameMap[targetFeatureName]);

            string targetFaceName = PartManager.ReferenceManager.GetCATIANameFromTransCADNameForHole(tFaceName);

            INFITF.Reference targetFace = PartManager.cPart.CreateReferenceFromBRepName(targetFaceName, targetFeature);

            return(targetFace);
        }
예제 #5
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);
        }
        // Pre
        public override void TranslateC2T(MECMOD.Shape cShape)
        {
            PARTITF.Groove cGroove = (PARTITF.Groove)cShape;

            FeatureSketch SketchManager = new FeatureSketch(PartManager);

            SketchManager.TranslateC2T(cGroove.Sketch);

            KnowledgewareTypeLib.Angle first  = cGroove.FirstAngle;
            KnowledgewareTypeLib.Angle second = cGroove.SecondAngle;

            double fA = first.Value;
            double sA = second.Value;

            PartManager.tFeatures.AddNewSolidCutRevolveFeature(cGroove.get_Name(), SketchManager.tReference, fA, TransCAD.StdRevolveEndType.StdRevolveEndType_Blind, sA, TransCAD.StdRevolveEndType.StdRevolveEndType_Blind, false);
        }
예제 #7
0
        // Pre
        public override void TranslateC2T(MECMOD.Shape cShape)
        {
            PARTITF.Rib cRib = (PARTITF.Rib)cShape;

            FeatureSketch ProfileSketch = new FeatureSketch(PartManager);

            ProfileSketch.TranslateC2T(cRib.Sketch);
            TransCAD.Reference profile = ProfileSketch.tReference;

            FeatureSketch GuideSketch = new FeatureSketch(PartManager);

            GuideSketch.TranslateC2T(cRib.CenterCurve);
            TransCAD.Reference guide = GuideSketch.tReference;

            PartManager.tFeatures.AddNewSolidProtrusionSweepFeature(cRib.get_Name(), profile, guide);
        }
예제 #8
0
        // Pre
        public override void TranslateC2T(MECMOD.Shape cShape)
        {
            PARTITF.Hole hole = (PARTITF.Hole)cShape;

            double diameter     = 0.0;
            double depth        = 0.0;
            double bottomAngle  = 180.0;
            double headDiameter = 0.0;
            double headAngle    = 0.0;
            double headDepth    = 0.0;

            object[] org = new object[3];
            hole.GetOrigin(org);

            diameter = hole.Diameter.Value;
            depth    = hole.BottomLimit.Dimension.Value;

            if (hole.BottomType == PARTITF.CatHoleBottomType.catVHoleBottom)
            {
                bottomAngle = hole.BottomAngle.Value;
            }

            if (hole.Type == PARTITF.CatHoleType.catCounterboredHole)
            {
                headDiameter = hole.HeadDiameter.Value;
                headDepth    = hole.HeadDepth.Value;

                PartManager.tFeatures.AddNewSolidHoleCounterboredFeature(hole.get_Name(), GetTargetFace(hole), (double)org[0], (double)org[1], (double)org[2], headDiameter / 2, headDepth, diameter / 2, depth - headDepth, bottomAngle);
            }
            else if (hole.Type == PARTITF.CatHoleType.catCountersunkHole)
            {
                headDepth = hole.HeadDepth.Value;
                headAngle = hole.HeadAngle.Value;

                headDiameter = diameter + 2 * Math.Tan(headAngle / 2 * Math.PI / 180) * headDepth;

                PartManager.tFeatures.AddNewSolidHoleCountersunkFeature(hole.get_Name(), GetTargetFace(hole), (double)org[0], (double)org[1], (double)org[2], diameter / 2, depth, headDiameter / 2, headAngle, bottomAngle);
            }
            else if (hole.Type == PARTITF.CatHoleType.catSimpleHole)
            {
                PartManager.tFeatures.AddNewSolidHoleSimpleFeature(hole.get_Name(), GetTargetFace(hole), (double)org[0], (double)org[1], (double)org[2], diameter / 2, depth);
            }
        }
        // Pre
        public override void TranslateC2T(MECMOD.Shape cShape)
        {
            PARTITF.Chamfer cChamfer = (PARTITF.Chamfer)cShape;

            double length = cChamfer.Length1.Value;

            TransCAD.References refElements = PartManager.tPart.CreateReferences();

            for (int i = 1; i <= cChamfer.ElementsToChamfer.Count; i++)
            {
                string elementName = cChamfer.ElementsToChamfer.Item(i).DisplayName;
                elementName = PartManager.ReferenceManager.GetTransCADNameFromCATIAName(elementName);

                TransCAD.Reference refElement = PartManager.tPart.SelectBrepByName(elementName);
                refElements.Add(refElement);
            }

            PartManager.tFeatures.AddNewSolidChamferFeature(cChamfer.get_Name(), refElements, length);
        }
예제 #10
0
        // Pre
        public override void TranslateC2T(MECMOD.Shape cShape)
        {
            PARTITF.Pad cPad = (PARTITF.Pad)cShape;

            // 스케치 변환
            FeatureSketch SketchManager = new FeatureSketch(PartManager);

            SketchManager.TranslateC2T(cPad.Sketch);

            string name = cPad.get_Name();

            PARTITF.Limit first  = cPad.FirstLimit;
            PARTITF.Limit second = cPad.SecondLimit;

            TransCAD.StdExtrudeEndType firstCond  = TransCAD.StdExtrudeEndType.Blind;
            TransCAD.StdExtrudeEndType secondCond = TransCAD.StdExtrudeEndType.Blind;

            if (first.LimitMode.ToString() == "catUpToLastLimit")
            {
                firstCond = TransCAD.StdExtrudeEndType.ThroughAll;
            }

            if (second.LimitMode.ToString() == "catUpToLastLimit")
            {
                secondCond = TransCAD.StdExtrudeEndType.ThroughAll;
            }

            bool isFlip = false;

            if (cPad.DirectionOrientation == PARTITF.CatPrismOrientation.catInverseOrientation)
            {
                isFlip = true;
            }

            PartManager.tFeatures.AddNewSolidProtrusionExtrudeFeature(name, SketchManager.tReference,
                                                                      first.Dimension.Value, firstCond, second.Dimension.Value, secondCond, isFlip);
        }
예제 #11
0
 public virtual void TranslateC2T(MECMOD.Shape cShape)
 {
     // Do nothing
 }
예제 #12
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!");
                    }
                }
            }
        }