Example #1
0
        public MeshModel Convert(IStpModel model)
        {
            var vectors = new List <Vector3>();
            var indices = new List <int>();

            GetValue <ClosedShell>(model, indices, vectors);
            var mesh = new MeshModel(vectors, indices);

            return(mesh);
        }
Example #2
0
 private void GetValue <T>(IStpModel model, List <int> indices, List <Vector3> vectors) where T : Entity
 {
     foreach (var element in model.All <T>())
     {
         var offset        = vectors.Count;
         var convertable   = CreateConvertable(element, model);
         var circleVectors = convertable.Points;
         var circleIndices = convertable.Indices;
         vectors.AddRange(circleVectors);
         indices.AddRange(circleIndices.Select(x => x + offset));
     }
 }
 private static IConvertable Convertable(Surface surface, IStpModel model)
 {
     if (surface.GetType() == typeof(CylindricalSurface))
     {
         return(new CylindricalSurfaceConvertable(surface, model));
     }
     else if (surface.GetType() == typeof(ConicalSurface))
     {
         return(new ConicalSurfaceConvertable(surface, model));
     }
     else if (surface.GetType() == typeof(Plane))
     {
         return(new PlaneConvertable(surface, model));
     }
     else if (surface.GetType() == typeof(ToroidalSurface))
     {
         return(new ToroidalSurfaceConvertable(surface, model));
     }
     throw new Exception("No convertable found!");
 }
Example #4
0
        private static IConvertable CreateConvertable <T>(T element, IStpModel 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 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");
        }
Example #5
0
 public LineConvertable(Line line, IStpModel model)
 {
     _line  = line;
     _model = model;
     Init();
 }
        public void SetUp()
        {
            var data = TestData.Content;

            _model = new StpParser().Parse(new MemoryStream(Encoding.UTF8.GetBytes(data)));
        }
Example #7
0
 public ClosedShellConveratable(ClosedShell closedShell, IStpModel model)
 {
     _closedShell = closedShell;
     _model       = model;
     Init();
 }
 public ClosedShellConveratable(ClosedShell closedShell, IStpModel model)
 {
     _closedShell = closedShell;
     _model = model;
     Init();
 }
 public CylindricalSurfaceConvertable(Surface surface, IStpModel model)
 {
     _surface = (CylindricalSurface)surface;
     _model   = model;
     Init();
 }
 public PlaneConvertable(Surface surface, IStpModel model)
 {
     _surface = (Plane)surface;
     _model = model;
     Init();
 }
 public ToroidalSurfaceConvertable(Surface surface, IStpModel model)
 {
     _surface = surface;
     _model = model;
     Init();
 }
 public CircleConvertable(Circle circle, IStpModel model)
 {
     _circle = circle;
     _model = model;
     Init();
 }
 public PlaneConvertable(Surface surface, IStpModel model)
 {
     _surface = (Plane)surface;
     _model   = model;
     Init();
 }
 public CircleConvertable(Circle circle, IStpModel model)
 {
     _circle = circle;
     _model  = model;
     Init();
 }
 public CylindricalSurfaceConvertable(Surface surface, IStpModel model)
 {
     _surface = (CylindricalSurface)surface;
     _model = model;
     Init();
 }
 public BoundConvertable(Bound bound, IStpModel model)
 {
     _bound = bound;
     _model = model;
     Init();
 }
Example #17
0
 public AdvancedFaceConvertable(AdvancedFace face, IStpModel model)
 {
     _face  = face;
     _model = model;
     Init();
 }
 public void SetUp()
 {
     var data = TestData.Content;
     _model = new StpParser().Parse(new MemoryStream(Encoding.UTF8.GetBytes(data)));
 }
 public ConicalSurfaceConvertable(Surface surface, IStpModel model)
 {
     _surface = surface;
     _model   = model;
     Init();
 }
 public AdvancedFaceConvertable(AdvancedFace face, IStpModel model)
 {
     _face = face;
     _model = model;
     Init();
 }
 public BoundConvertable(Bound bound, IStpModel model)
 {
     _bound = bound;
     _model = model;
     Init();
 }
 private static IConvertable Convertable(Surface surface, IStpModel model)
 {
     if (surface.GetType() == typeof (CylindricalSurface))
     {
         return new CylindricalSurfaceConvertable(surface, model);
     }
     else if (surface.GetType() == typeof(ConicalSurface))
     {
         return new ConicalSurfaceConvertable(surface, model);
     }
     else if (surface.GetType() == typeof(Plane))
     {
         return new PlaneConvertable(surface, model);
     }
     else if (surface.GetType() == typeof(ToroidalSurface))
     {
         return new ToroidalSurfaceConvertable(surface, model);
     }
     throw new Exception("No convertable found!");
 }