예제 #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
        public TransCAD.IFeature GetFeatureFromReference(TransCAD.Reference reference)
        {
            // Reference 형식으로 저장 된 특징형상을 Feature 형식으로 리턴
            if (!isSubAssemblyPart)
            {
                IEnumerator tFeatureList = tFeatures.GetEnumerator();

                while (tFeatureList.MoveNext())
                {
                    TransCAD.IFeature tFeature = (TransCAD.IFeature)tFeatureList.Current;

                    if (tFeature.Name == reference.ReferenceeName)
                    {
                        return(tFeature);
                    }
                }
            }
            else
            {
                tFeatures = tAssemDoc.Assem.Component[0].Part[partNum + 1].Features;

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

                    if (tFeature.Name == reference.ReferenceeName)
                    {
                        return(tFeature);
                    }
                }
            }

            return(null);
        }
예제 #3
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);
        }
        // Post
        public override void TranslateT2C(TransCAD.IFeature tFeature)
        {
            TransCAD.IStdSolidChamferFeature tChamfer = (TransCAD.IStdSolidChamferFeature)tFeature;

            double length = tChamfer.Length;

            TransCAD.ChamferType chamferType = tChamfer.ChamferType;

            PARTITF.Chamfer cChamfer = PartManager.cShapeFactory.AddNewChamfer(null, PARTITF.CatChamferPropagation.catMinimalChamfer, PARTITF.CatChamferMode.catTwoLengthChamfer, PARTITF.CatChamferOrientation.catNoReverseChamfer, length, length);

            IEnumerator edges = tChamfer.SelectedEdges.GetEnumerator();

            while (edges.MoveNext())
            {
                TransCAD.Reference edge = (TransCAD.Reference)edges.Current;

                string           cRefName = PartManager.ReferenceManager.GetCATIANameFromTransCADName(edge.ReferenceeName);
                INFITF.Reference cRef     = PartManager.cPart.CreateReferenceFromBRepName(cRefName, PartManager.GetRecentFeature());

                cChamfer.AddElementToChamfer(cRef);
            }

            PartManager.cPart.UpdateObject(cChamfer);
            PartManager.ReferenceManager.NameMap.Add(tChamfer.Name, cChamfer.get_Name());
        }
        // Post
        public override void TranslateT2C(TransCAD.IFeature tFeature)
        {
            TransCAD.IStdSolidFilletConstantFeature tFillet = (TransCAD.IStdSolidFilletConstantFeature)tFeature;

            double radius = tFillet.Radius;

            TransCAD.PropagationType propagation = tFillet.Propagation;

            PARTITF.ConstRadEdgeFillet cFillet = PartManager.cShapeFactory.AddNewEdgeFilletWithConstantRadius(null, PARTITF.CatFilletEdgePropagation.catMinimalFilletEdgePropagation, radius);

            IEnumerator edges = tFillet.FilletEdges.GetEnumerator();

            while (edges.MoveNext())
            {
                TransCAD.Reference edge = (TransCAD.Reference)edges.Current;

                string           cRefName = PartManager.ReferenceManager.GetCATIANameFromTransCADName(edge.ReferenceeName);
                INFITF.Reference cRef     = PartManager.cPart.CreateReferenceFromBRepName(cRefName, PartManager.GetRecentFeature());

                cFillet.AddObjectToFillet(cRef);
            }

            if (propagation == TransCAD.PropagationType.Tangency)
            {
                cFillet.EdgePropagation = PARTITF.CatFilletEdgePropagation.catTangencyFilletEdgePropagation;
            }

            PartManager.cPart.UpdateObject(cFillet);
            PartManager.ReferenceManager.NameMap.Add(tFillet.Name, cFillet.get_Name());
        }
        // 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);
        }
예제 #7
0
        private TransCAD.Reference GetTargetFace(PARTITF.Hole hole)
        {
            object[] axis = new object[9];

            hole.Sketch.GetAbsoluteAxisData(axis);

            TransCAD.Reference targetFace = PartManager.tPart.SelectPlaneByAxis((double)axis[0], (double)axis[1], (double)axis[2],
                                                                                (double)axis[3], (double)axis[4], (double)axis[5],
                                                                                (double)axis[6], (double)axis[7], (double)axis[8]);

            return(targetFace);
        }
예제 #8
0
        public override void toTransCAD()
        {
            string[] relTCFace = new string[2];
            int      countMatch;

            TransCAD.Reference[] refGeom = new TransCAD.Reference[2];

            for (int i = 0; i < assemManager_.numComponents; i++)
            {
                int numFaces = assemManager_.tcad_PartList[i].Solid.Faces.Count;

                for (int j = 1; j <= numFaces; j++)
                {
                    int    numVertices = assemManager_.tcad_PartList[i].Solid.Faces[j].Vertices.Count;
                    string faceName    = assemManager_.tcad_PartList[i].Solid.Faces[j].Name;
                    Console.WriteLine(faceName);
                    countMatch = 0;
                    for (int k = 1; k <= numVertices; k++)
                    {
                        TransCAD.Vertex tVtx = assemManager_.tcad_PartList[i].Solid.Faces[j].Vertices[k];

                        Console.Write(" (" + tVtx.X + "," + tVtx.Y + "," + tVtx.z + ") ");
                        if (pointMatch.vertexMatching(tVtx, NXrefPoints1, NXrefPoints2))
                        {
                            countMatch++;
                        }

                        if (countMatch == 3)
                        {
                            relTCFace[i] = assemManager_.tcad_PartList[i].Solid.Faces[j].Name;
                            break;
                        }
                    }
                    Console.WriteLine();
                }
                refGeom[i] = assemManager_.tcad_PartList[i].SelectBrepByName(relTCFace[i]);
            }
            if (ConstType == "Touch")
            {
                assemManager_.tConstraints.AddNewAssemblyIncidenceConstraint("Incidence", assemManager_.tcad_PartList[0], refGeom[0], assemManager_.tcad_PartList[1], refGeom[1], TransCAD.StdAssemblyIncidenceType.Opposite);
            }
            else
            {
                assemManager_.tConstraints.AddNewAssemblyIncidenceConstraint("Incidence", assemManager_.tcad_PartList[0], refGeom[0], assemManager_.tcad_PartList[1], refGeom[1], TransCAD.StdAssemblyIncidenceType.Same);
            }

            assemManager_.tAssemDoc.Update();

            //assemManager_.tcad_PartList[i];
            //assemManager_.tConstraints.AddNewAssemblyIncidenceConstraint("Incidence", tcad_refGeomRelatedParts[0], tcad_RefGeoms[0], tcad_refGeomRelatedParts[1], tcad_RefGeoms[1], TransCAD.StdAssemblyIncidenceType.Opposite);
            //assemManager_.tAssemDoc.Update();
        }
예제 #9
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);
        }
        // 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);
        }
예제 #11
0
        // Post
        public override void TranslateT2C(TransCAD.IFeature tFeature)
        {
            TransCAD.IStdSolidOperatePatternRectangularFeature tRectPattern = (TransCAD.IStdSolidOperatePatternRectangularFeature)tFeature;

            double[] colDir = new double[3];
            double[] rowDir = new double[3];

            tRectPattern.ColumnDirection(out colDir[0], out colDir[1], out colDir[2]);
            tRectPattern.RowDirection(out rowDir[0], out rowDir[1], out rowDir[2]);

            int    colInstance = tRectPattern.ColumnNumber;
            double colSpacing  = tRectPattern.ColumnSpacing;
            int    rowInstance = tRectPattern.RowNumber;
            double rowSpacing  = tRectPattern.RowSpacing;

            PARTITF.RectPattern cRectPattern = PartManager.cShapeFactory.AddNewRectPattern(null, 2, 1, 20.0, 20.0, 1, 1, null, null, true, true, 0.0);

            IEnumerator tTargetFeatures = tRectPattern.TargetFeatures.GetEnumerator();

            while (tTargetFeatures.MoveNext())
            {
                TransCAD.Reference tTargetFeature = (TransCAD.Reference)tTargetFeatures.Current;

                cRectPattern.ItemToCopy = PartManager.cShapes.Item(PartManager.ReferenceManager.NameMap[tTargetFeature.ReferenceeName]);
            }

            cRectPattern.FirstRectangularPatternParameters  = PARTITF.CatRectangularPatternParameters.catInstancesandSpacing;
            cRectPattern.SecondRectangularPatternParameters = PARTITF.CatRectangularPatternParameters.catInstancesandSpacing;

            INFITF.Reference referencePlane = GetReferencePlane(cRectPattern, colDir, rowDir);
            cRectPattern.SetFirstDirection(referencePlane);
            cRectPattern.SetSecondDirection(referencePlane);

            cRectPattern.FirstDirectionRepartition.InstancesCount.Value = colInstance;
            cRectPattern.FirstDirectionRepartition.Spacing.Value        = colSpacing;

            cRectPattern.SecondDirectionRepartition.InstancesCount.Value = rowInstance;
            cRectPattern.SecondDirectionRepartition.Spacing.Value        = rowSpacing;

            PartManager.cPart.UpdateObject(cRectPattern);
            PartManager.ReferenceManager.NameMap.Add(tRectPattern.Name, cRectPattern.get_Name());
        }
예제 #12
0
        // Pre
        public void TranslateC2T(MECMOD.Sketch cSketch)
        {
            string sketchName = cSketch.get_Name();

            MECMOD.GeometricElements cGeoms = cSketch.GeometricElements;

            cCenterLine = cSketch.CenterLine;

            object[] cCoords = new object[9];
            cSketch.GetAbsoluteAxisData(cCoords);

            TransCAD.Reference        tSktReference = PartManager.ReferenceManager.GetTransCADSketchReference(cSketch);
            TransCAD.StdSketchFeature tSketch       = PartManager.tFeatures.AddNewSketchFeature(sketchName, tSktReference);

            tSketch.SetCoordinateSystem((double)cCoords.GetValue(0), (double)cCoords.GetValue(1), (double)cCoords.GetValue(2),
                                        (double)cCoords.GetValue(3), (double)cCoords.GetValue(4), (double)cCoords.GetValue(5),
                                        (double)cCoords.GetValue(6), (double)cCoords.GetValue(7), (double)cCoords.GetValue(8));

            tSketchEditor = tSketch.OpenEditorEx(false);

            for (int i = 1; i <= cGeoms.Count; i++)
            {
                MECMOD.GeometricElement cGeom = cGeoms.Item(i);

                if (cGeom.GeometricType == MECMOD.CatGeometricType.catGeoTypeLine2D)
                {
                    SketchLine2D line2D = new SketchLine2D(this);
                    line2D.TranslateC2T(cGeom);
                }
                else if (cGeom.GeometricType == MECMOD.CatGeometricType.catGeoTypeCircle2D)
                {
                    SketchCircle2D circle2D = new SketchCircle2D(this);
                    circle2D.TranslateC2T(cGeom);
                }
            }

            tSketchEditor.Close();

            tReference = PartManager.tPart.SelectObjectByName(sketchName);
        }
예제 #13
0
        // Post
        public override void TranslateT2C(TransCAD.IFeature tFeature)
        {
            TransCAD.IStdSolidOperatePatternCircularFeature tCircPattern = (TransCAD.IStdSolidOperatePatternCircularFeature)tFeature;

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

            tCircPattern.CenterAxis(out center[0], out center[1], out center[2], out axis[0], out axis[1], out axis[2]);

            int    angInstance = tCircPattern.AngleNumber;
            double angSpacing  = tCircPattern.AngleIncrement;
            int    radInstance = tCircPattern.RadialNumber;
            double radSpacing  = tCircPattern.RadialSpacing;

            PARTITF.CircPattern cCircPattern = PartManager.cShapeFactory.AddNewCircPattern(null, 1, 2, 20.0, 45.0, 1, 1, null, null, true, 0.0, true);

            IEnumerator tTargetFeatures = tCircPattern.TargetFeatures.GetEnumerator();

            while (tTargetFeatures.MoveNext())
            {
                TransCAD.Reference tTargetFeature = (TransCAD.Reference)tTargetFeatures.Current;

                cCircPattern.ItemToCopy = PartManager.cShapes.Item(PartManager.ReferenceManager.NameMap[tTargetFeature.ReferenceeName]);
            }

            cCircPattern.CircularPatternParameters = PARTITF.CatCircularPatternParameters.catInstancesandAngularSpacing;

            INFITF.Reference rotationAxis = GetRotationAxis(cCircPattern, center, axis);
            cCircPattern.SetRotationAxis(rotationAxis);

            cCircPattern.AngularRepartition.InstancesCount.Value = angInstance;
            cCircPattern.AngularRepartition.AngularSpacing.Value = angSpacing;

            cCircPattern.RadialRepartition.InstancesCount.Value = radInstance;
            cCircPattern.RadialRepartition.Spacing.Value        = radSpacing;

            PartManager.cPart.UpdateObject(cCircPattern);
            PartManager.ReferenceManager.NameMap.Add(tCircPattern.Name, cCircPattern.get_Name());
        }
예제 #14
0
        public TransCAD.Reference GetTransCADSketchReference(MECMOD.Sketch cSketch)
        {
            object[] axis = new object[9];
            cSketch.GetAbsoluteAxisData(axis);
            Tool.Round(axis);

            string cSketchName = cSketch.get_Name();

            TransCAD.Reference tRef = null;

            // CATIA 스케치 좌표계로부터 TransCAD에서 알맞은 레퍼런스를 선택
            // 만약, CATIA 스케치 레퍼런스 이름을 얻어올 수 있으면 다른 방식으로 처리 가능
            if (GetTransCADPlaneType(axis) == 1)  // YZ 평면
            {
                if (axis.GetValue(0).Equals(0.0)) // X 좌표가 0일 때
                {
                    tRef = PartManager.tPart.SelectObjectByName("YZPlane");
                }
                else
                {
                    // 면 선택
                    tRef = PartManager.tPart.SelectPlaneByAxis((double)axis.GetValue(0), (double)axis.GetValue(1), (double)axis.GetValue(2),
                                                               (double)axis.GetValue(3), (double)axis.GetValue(4), (double)axis.GetValue(5),
                                                               (double)axis.GetValue(6), (double)axis.GetValue(7), (double)axis.GetValue(8));
                    // 새평면 생성
                    if (tRef == null)
                    {
                        tRef = PartManager.tPart.SelectObjectByName("YZPlane");

                        double offset = (double)axis.GetValue(0);

                        TransCAD.StdDatumPlaneOffsetFeature tDatum = null;

                        if (offset > 0.0)
                        {
                            tDatum = PartManager.tFeatures.AddNewDatumPlaneOffsetFeature("Plane for " + cSketchName, tRef, offset, false);
                        }
                        else
                        {
                            tDatum = PartManager.tFeatures.AddNewDatumPlaneOffsetFeature("Plane for " + cSketchName, tRef, Math.Abs(offset), true);
                        }

                        tRef = PartManager.tPart.SelectObjectByName(tDatum.Name);
                    }
                }
            }
            else if (GetTransCADPlaneType(axis) == 0) // XY 평면
            {
                if (axis.GetValue(2).Equals(0.0))     // Z좌표가 0일 때
                {
                    tRef = PartManager.tPart.SelectObjectByName("XYPlane");
                }
                else
                {
                    // 면 선택
                    tRef = PartManager.tPart.SelectPlaneByAxis((double)axis.GetValue(0), (double)axis.GetValue(1), (double)axis.GetValue(2),
                                                               (double)axis.GetValue(3), (double)axis.GetValue(4), (double)axis.GetValue(5),
                                                               (double)axis.GetValue(6), (double)axis.GetValue(7), (double)axis.GetValue(8));

                    // 새평면 생성
                    if (tRef == null)
                    {
                        tRef = PartManager.tPart.SelectObjectByName("XYPlane");

                        double offset = (double)axis.GetValue(2);

                        TransCAD.StdDatumPlaneOffsetFeature tDatum = null;

                        if (offset > 0.0)
                        {
                            tDatum = PartManager.tFeatures.AddNewDatumPlaneOffsetFeature("Plane for " + cSketchName, tRef, offset, false);
                        }
                        else
                        {
                            tDatum = PartManager.tFeatures.AddNewDatumPlaneOffsetFeature("Plane for " + cSketchName, tRef, Math.Abs(offset), true);
                        }

                        tRef = PartManager.tPart.SelectObjectByName(tDatum.Name);
                    }
                }
            }
            else if (GetTransCADPlaneType(axis) == 2) // ZX 평면
            {
                if (axis.GetValue(1).Equals(0.0))     // Y좌표가 0일 때
                {
                    tRef = PartManager.tPart.SelectObjectByName("ZXPlane");
                }
                else
                {
                    // 면 선택
                    tRef = PartManager.tPart.SelectPlaneByAxis((double)axis.GetValue(0), (double)axis.GetValue(1), (double)axis.GetValue(2),
                                                               (double)axis.GetValue(3), (double)axis.GetValue(4), (double)axis.GetValue(5),
                                                               (double)axis.GetValue(6), (double)axis.GetValue(7), (double)axis.GetValue(8));
                    // 새평면 생성
                    if (tRef == null)
                    {
                        tRef = PartManager.tPart.SelectObjectByName("ZXPlane");

                        double offset = (double)axis.GetValue(1);

                        TransCAD.StdDatumPlaneOffsetFeature tDatum = null;

                        if (offset > 0.0)
                        {
                            tDatum = PartManager.tFeatures.AddNewDatumPlaneOffsetFeature("Plane for " + cSketchName, tRef, offset, false);
                        }
                        else
                        {
                            tDatum = PartManager.tFeatures.AddNewDatumPlaneOffsetFeature("Plane for " + cSketchName, tRef, Math.Abs(offset), true);
                        }

                        tRef = PartManager.tPart.SelectObjectByName(tDatum.Name);
                    }
                }
            }
            else // 이 외의 경우
            {
                tRef = PartManager.tPart.SelectPlaneByAxis((double)axis.GetValue(0), (double)axis.GetValue(1), (double)axis.GetValue(2),
                                                           (double)axis.GetValue(3), (double)axis.GetValue(4), (double)axis.GetValue(5),
                                                           (double)axis.GetValue(6), (double)axis.GetValue(7), (double)axis.GetValue(8));
                // 새 평면 생성
                if (tRef == null)
                {
                    TransCAD.StdDatumPlaneOffsetFeature tDatum = PartManager.tFeatures.AddNewDatumPlaneOffsetFeature2("Plane for " + cSketchName,
                                                                                                                      (double)axis.GetValue(0), (double)axis.GetValue(1), (double)axis.GetValue(2),
                                                                                                                      (double)axis.GetValue(3), (double)axis.GetValue(4), (double)axis.GetValue(5),
                                                                                                                      (double)axis.GetValue(6), (double)axis.GetValue(7), (double)axis.GetValue(8), false);

                    tRef = PartManager.tPart.SelectObjectByName(tDatum.Name);
                }
            }

            return(tRef);
        }
        //각 Constraint에서 사용하는 Master/Slave Part의 ReferenceName을 refCommand 구조체로 리턴
        private refCommand TestRefer(TransCAD.StdAssemConstraint tConstraint, CTYPE i, PreStack _stack) //constrain 받아오기
        {
            CTYPE      type   = i;
            refCommand para   = new refCommand();
            refCommand result = new refCommand();

            ReferenceClass.ref_Post m_refer = new ReferenceClass.ref_Post();
            m_refer.Set_stack_info(_stack);
            double value = 0;

            //Type Define TransCAD 7.0

            /*
             * TransCAD.StdAssemblyConstraintType.StdAssemblyConstraintType_Angle;
             * TransCAD.StdAssemblyConstraintType.StdAssemblyConstraintType_Coaxial;
             * TransCAD.StdAssemblyConstraintType.StdAssemblyConstraintType_Coincidence;
             * TransCAD.StdAssemblyConstraintType.StdAssemblyConstraintType_Distance;
             * TransCAD.StdAssemblyConstraintType.StdAssemblyConstraintType_Fix;
             * TransCAD.StdAssemblyConstraintType.StdAssemblyConstraintType_Parallel;
             * TransCAD.StdAssemblyConstraintType.StdAssemblyConstraintType_Perpendicular;
             */


            switch (type)
            {
            case CTYPE.StdAssemblyConstraintType_Coaxial:

                TransCAD.StdAssemConstraintCoaxial coax = (TransCAD.StdAssemConstraintCoaxial)tConstraint;
                Console.WriteLine("Loading Coaxial......................................");

                _debug          = coax.Name;
                para.command    = (int)type;
                para.param      = "Axis" + ":(";
                para.MasterPart = coax.ConstrainedPart.Name;
                para.SlavePart  = coax.ReferencePart.Name;

                para.MasterPart_Ref = coax.ConstrainedEntity.ReferenceeName;
                _debug = coax.ConstrainedEntity.Name;


                ///[Edit]For test A1 TestRally 20190712
                {
                    //TransCAD.Reference tempref = coax.ConstrainedEntity;
                    //bool res = tempref.IsPlanarFace;

                    //if we get edge name we have to find surface that define axis
                    if (para.MasterPart_Ref.IndexOf('#') != -1)
                    {
                        string[]      _split = para.MasterPart_Ref.Split('#');
                        TransCAD.Part ptr    = coax.ConstrainedPart;

                        for (int s = 0; s < _split.Length; s++)
                        {
                            string             temp    = _split[s].Substring(_split[s].IndexOf(',', _split[s].IndexOf(',') + 1) + 1);
                            TransCAD.Reference tempref = ptr.SelectBrepByName(temp);
                            if (!tempref.IsPlanar)
                            {
                                para.MasterPart_Ref = _split[s];
                                break;
                            }
                            para.MasterPart_Ref = _split[s];
                        }
                    }
                }


                para.SlavePart_Ref = coax.ReferenceEntity.ReferenceeName;
                _debug             = coax.ReferenceEntity.Name;

                ///[Edit]For test A1 TestRally 20190712
                {
                    //if we get edge name we have to find surface that define axis
                    if (para.SlavePart_Ref.IndexOf('#') != -1)
                    {
                        string[] _split = para.SlavePart_Ref.Split('#');
                        //para.SlavePart_Ref = _split[1];

                        //Method 2 : Find by name of 'Sketch'
                        for (int j = 0; j < _split.Length; j++)
                        {
                            if (_split[j].IndexOf("Sketch") > 0)
                            {
                                para.SlavePart_Ref = _split[j];
                            }
                        }
                    }
                    if (para.SlavePart_Ref.IndexOf('#') != -1)
                    {
                        string[]      _split = para.SlavePart_Ref.Split('#');
                        TransCAD.Part ptr    = coax.ReferencePart;

                        for (int s = 0; s < _split.Length; s++)
                        {
                            string             temp    = _split[s].Substring(_split[s].IndexOf(',', _split[s].IndexOf(',') + 1) + 1);
                            TransCAD.Reference tempref = ptr.SelectBrepByName(temp);
                            if (!tempref.IsPlanar)
                            {
                                para.SlavePart_Ref = _split[s];
                                break;
                            }
                            para.SlavePart_Ref = _split[s];
                        }
                    }
                }



                Console.WriteLine(coax.ConstrainedEntity.ReferenceeName + ".&&." + coax.ReferenceEntity.ReferenceeName);
                break;



            case CTYPE.StdAssemblyConstraintType_Coincidence:

                TransCAD.StdAssemConstraintCoincidence coin = (TransCAD.StdAssemConstraintCoincidence)tConstraint;
                Console.WriteLine("Loading COINCIDENCE......................................");

                _debug              = coin.Name;
                para.command        = (int)type;
                para.param          = "";
                para.MasterPart     = coin.ConstrainedPart.Name;
                para.SlavePart      = coin.ReferencePart.Name;
                para.MasterPart_Ref = coin.ConstrainedEntity.ReferenceeName;
                para.SlavePart_Ref  = coin.ReferenceEntity.ReferenceeName;
                Console.WriteLine(coin.ConstrainedEntity.ReferenceeName + ".&&." + coin.ReferenceEntity.ReferenceeName);

                break;

            // Mutahar 18-10-09
            case CTYPE.StdAssemblyConstraintType_Angle:      //(Surface-Surface)
                TransCAD.StdAssemConstraintAngle ang = (TransCAD.StdAssemConstraintAngle)tConstraint;
                Console.WriteLine("Loading Angle......................................");

                _debug              = ang.Name;
                para.command        = (int)type;
                para.param          = "";
                para.MasterPart     = ang.ConstrainedPart.Name;
                para.SlavePart      = ang.ReferencePart.Name;
                para.MasterPart_Ref = ang.ConstrainedEntity.ReferenceeName;
                para.SlavePart_Ref  = ang.ReferenceEntity.ReferenceeName;
                value = ang.Angle;
                Console.WriteLine(ang.ConstrainedEntity.ReferenceeName + ".&&." + ang.ReferenceEntity.ReferenceeName);
                //Angle Value?

                break;

            case CTYPE.StdAssemblyConstraintType_Distance:      //(Surface-Surface)
                TransCAD.StdAssemConstraintDistance dist = (TransCAD.StdAssemConstraintDistance)tConstraint;
                Console.WriteLine("Loading Distance......................................");

                _debug              = dist.Name;
                para.command        = (int)type;
                para.param          = "";
                para.MasterPart     = dist.ConstrainedPart.Name;
                para.SlavePart      = dist.ReferencePart.Name;
                para.MasterPart_Ref = dist.ConstrainedEntity.ReferenceeName;
                para.SlavePart_Ref  = dist.ReferenceEntity.ReferenceeName;
                Console.WriteLine(dist.ConstrainedEntity.ReferenceeName + ".&&." + dist.ReferenceEntity.ReferenceeName);
                value = dist.Distance;
                //Offset Value?

                break;


            default:
                Console.WriteLine("Anything........");
                break;
            }
            Console.WriteLine("////////////////////////////////////////////////////////////////////////");
            result        = m_refer.ConvertRefPost(para);
            result.option = value;
            Console.WriteLine("////////////////////////////////////////////////////////////////////////");
            Console.WriteLine("ConsNum : " + result.command.ToString());
            Console.WriteLine("master : " + result.MasterPart_Ref);
            Console.WriteLine("slave : " + result.SlavePart_Ref);
            Console.WriteLine("////////////////////////////////////////////////////////////////////////");

            return(result);
        }