Exemplo n.º 1
0
        internal static Solid[] OpenSolids(Stream s, string filename)
        {
            var now         = DateTime.Now;
            var resultsList = new List <TessellatedSolid>();

#if !DEBUG
            try
            {
#endif
            var start        = "HEADER;";
            var end          = "ENDSEC;";
            var headerStream = ParseHelper.FindSection(s, start, end);
            start = "DATA;";
            var dataStream          = ParseHelper.FindSection(s, start, end);
            var headerEntityStrings = ParseHelper.GetEntityStrings(headerStream);
            var dataEntityStrings   = ParseHelper.GetEntityStrings(dataStream);

            var model = new STEPFileData
            {
                FileName = filename,
                Name     = Path.GetFileNameWithoutExtension(filename),
            };
            model.Comments.AddRange(headerEntityStrings);
            model.Data = MakeEntityDictionary(dataEntityStrings);
            foreach (var entity in model.Data.Values)
            {
                entity.Init(model.Data);
            }
            return(model.CreateSolids());

#if !DEBUG
        }

        catch
        {
            Message.output("Unable to read in STEP file.", 1);
            return(null);
        }
#endif
        }
Exemplo n.º 2
0
        private static IConvertable CreateConvertable <T>(T element, STEPFileData model)
            where T : Entity
        {
            var type = typeof(T);

            if (type == typeof(Circle))
            {
                return(new CircleConvertable(element as Circle, model));
            }
            if (type == typeof(Line))
            {
                return(new LineConvertable(element as TVGL.IOFunctions.Step.Line, model));
            }
            if (type == typeof(AdvancedFace))
            {
                return(new AdvancedFaceConvertable(element as AdvancedFace, model));
            }
            if (type == typeof(ClosedShell))
            {
                return(new ClosedShellConveratable(element as ClosedShell, model));
            }
            throw new Exception("Not supported");
        }
Exemplo n.º 3
0
 public CircleConvertable(Circle circle, STEPFileData model)
 {
     _circle = circle;
     _model  = model;
     Init();
 }
 public ClosedShellConveratable(ClosedShell closedShell, STEPFileData model)
 {
     _closedShell = closedShell;
     _model       = model;
     Init();
 }
Exemplo n.º 5
0
 public LineConvertable(Line line, STEPFileData model)
 {
     _line  = line;
     _model = model;
     Init();
 }
Exemplo n.º 6
0
 public AdvancedFaceConvertable(AdvancedFace face, STEPFileData model)
 {
     _face  = face;
     _model = model;
     Init();
 }