AddPath() 공개 메소드

public AddPath ( IList iTrimmedCurves, bool isClosed, double strokeWidth, System.Drawing.Color strokeColor, System.Drawing.Color fillColor ) : void
iTrimmedCurves IList
isClosed bool
strokeWidth double
strokeColor System.Drawing.Color
fillColor System.Drawing.Color
리턴 void
        public override void SaveFile(string path)
        {
            var svgDoc = new SpaceClaim.Svg.Document(path);

            Part mainPart = Window.ActiveWindow.Scene as Part;
            if (mainPart == null)
                return;

            Color? strokeColor;
            Color? fillColor = null;

            foreach (IDesignFace iDesignFace in mainPart.GetDescendants<IDesignFace>()) {
                Face face = iDesignFace.Master.Shape;
                strokeColor = iDesignFace.GetAncestor<IDesignBody>().GetVisibleColor();
                fillColor = Color.FromArgb(127, strokeColor.Value);

                foreach (Loop loop in face.Loops)
                    svgDoc.AddPath(loop.Fins.Select(f => (ITrimmedCurve) f.Edge).ToList(), true, 1, strokeColor, fillColor);
            }

            Dictionary<Layer, List<CurveSegment>> CurvesOnLayer = mainPart.GetCurvesByLayer();
            AddCurvesByLayer(svgDoc, fillColor, CurvesOnLayer);

            foreach (IComponent iComponent in mainPart.Components) {
                CurvesOnLayer = iComponent.GetCurvesByLayer();
                AddCurvesByLayer(svgDoc, fillColor, CurvesOnLayer);
            }

            svgDoc.SaveXml();
        }
예제 #2
0
 private static void AddCurvesByLayer(SpaceClaim.Svg.Document svgDoc, Color?fillColor, Dictionary <Layer, List <CurveSegment> > CurvesOnLayer)
 {
     foreach (Layer layer in CurvesOnLayer.Keys)
     {
         List <List <ITrimmedCurve> > profiles = CurvesOnLayer[layer].Cast <ITrimmedCurve>().ToList().ExtractChains().Select(c => c.ToList()).ToList();
         foreach (List <ITrimmedCurve> profile in profiles)
         {
             svgDoc.AddPath(profile, false, GetLineWeight(layer.GetLineWeight(null)), layer.GetColor(null), fillColor);
         }
     }
 }
예제 #3
0
        public override void SaveFile(string path)
        {
            var svgDoc = new SpaceClaim.Svg.Document(path);

            Part mainPart = Window.ActiveWindow.Scene as Part;

            if (mainPart == null)
            {
                return;
            }

            Color?strokeColor;
            Color?fillColor = null;

            foreach (IDesignFace iDesignFace in mainPart.GetDescendants <IDesignFace>())
            {
                Face face = iDesignFace.Master.Shape;
                strokeColor = iDesignFace.GetAncestor <IDesignBody>().GetVisibleColor();
                fillColor   = Color.FromArgb(127, strokeColor.Value);

                foreach (Loop loop in face.Loops)
                {
                    svgDoc.AddPath(loop.Fins.Select(f => (ITrimmedCurve)f.Edge).ToList(), true, 1, strokeColor, fillColor);
                }
            }


            Dictionary <Layer, List <CurveSegment> > CurvesOnLayer = mainPart.GetCurvesByLayer();

            AddCurvesByLayer(svgDoc, fillColor, CurvesOnLayer);

            foreach (IComponent iComponent in mainPart.Components)
            {
                CurvesOnLayer = iComponent.GetCurvesByLayer();
                AddCurvesByLayer(svgDoc, fillColor, CurvesOnLayer);
            }

            svgDoc.SaveXml();
        }