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(); }
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(); }