Ejemplo n.º 1
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);
        }