本文整理汇总了C#中netDxf.DxfDocument类的典型用法代码示例。如果您正苦于以下问题:C# DxfDocument类的具体用法?C# DxfDocument怎么用?C# DxfDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DxfDocument类属于netDxf命名空间,在下文中一共展示了DxfDocument类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ReadDrawing
public Drawing ReadDrawing(string dxfFileName, Canvas canvas)
{
doc = new DxfDocument();
doc.Load(dxfFileName);
drawing = new Drawing(canvas);
ReadLines();
ReadPolylines();
ReadArcs();
ReadCircles();
ReadInserts();
drawing.Recalculate();
return drawing;
}
开发者ID:wcatykid,项目名称:GeoShader,代码行数:16,代码来源:DXFDrawingDeserializer.cs
示例2: Add
private void Add(DxfDocument dxf, Core2D.Project.XDocument document)
{
foreach (var page in document.Pages)
{
var layout = new Layout(page.Name)
{
PlotSettings = new PlotSettings()
{
PaperSizeName = $"{page.Template.Name}_({page.Template.Width}_x_{page.Template.Height}_MM)",
LeftMargin = 0.0,
BottomMargin = 0.0,
RightMargin = 0.0,
TopMargin = 0.0,
PaperSize = new Vector2(page.Template.Width, page.Template.Height),
Origin = new Vector2(0.0, 0.0),
PaperUnits = PlotPaperUnits.Milimeters,
PaperRotation = PlotRotation.NoRotation
}
};
dxf.Layouts.Add(layout);
dxf.ActiveLayout = layout.Name;
Add(dxf, page);
}
}
开发者ID:Core2D,项目名称:Core2D,代码行数:25,代码来源:DxfRenderer.IProjectExporter.cs
示例3: Draw
/// <summary>
/// 绘制风扇
/// </summary>
/// <param name="dxf"></param>
/// <param name="startPoint">风扇起点,如果为横置,由左向右;如果为竖置,由下到上</param>
/// <param name="endPoint">风扇终点,如果为横置,由左向右;如果为竖置,由下到上</param>
/// <param name="pointerLocation">箭头位置,默认=0为无,=1代表箭头在中间,=2代表箭头在底部</param>
public static void Draw(DxfDocument dxf, Vector3f startPoint, Vector3f endPoint,int pointerLocation=0)
{
Layer layer = new Layer("line");
Line line = new Line(startPoint, endPoint);
line.Layer = layer;
dxf.AddEntity(line);
//如果为横置
if (startPoint.Y == endPoint.Y)
{
float segment = (endPoint.X - startPoint.X) / 4;
Slash.Draw(dxf, new Location(startPoint.X + segment, startPoint.Y, startPoint.Z));
Slash.Draw(dxf, new Location(startPoint.X + 2 * segment, startPoint.Y, startPoint.Z));
Slash.Draw(dxf, new Location(startPoint.X + 3 * segment, startPoint.Y, startPoint.Z));
}
//如果为竖置
else if (startPoint.X == endPoint.X)
{
float segment = (endPoint.Y - startPoint.Y) / 5;
Slash.Draw(dxf, new Location(startPoint.X, startPoint.Y + segment, startPoint.Z));
Slash.Draw(dxf, new Location(startPoint.X, startPoint.Y + 2 * segment, startPoint.Z));
Slash.Draw(dxf, new Location(startPoint.X, startPoint.Y + 3 * segment, startPoint.Z));
Slash.Draw(dxf, new Location(startPoint.X, startPoint.Y + 4 * segment, startPoint.Z));
if (pointerLocation == 1)
{
LinePointer.Draw(dxf,new Location(startPoint.X,(startPoint.Y+endPoint.Y)/2,startPoint.Z));
}
else if(pointerLocation==2)
{
LinePointer.Draw(dxf, new Location(startPoint.X, startPoint.Y, startPoint.Z));
}
}
}
开发者ID:Spritutu,项目名称:ntxx,代码行数:40,代码来源:Fan.cs
示例4: DxfDocument
/// <inheritdoc/>
void Core2D.Interfaces.IProjectExporter.Save(string path, Core2D.Project.XProject project)
{
_outputPath = System.IO.Path.GetDirectoryName(path);
var dxf = new DxfDocument(DxfVersion.AutoCad2010);
Add(dxf, project);
dxf.Save(path);
ClearCache(isZooming: false);
}
开发者ID:Core2D,项目名称:Core2D,代码行数:11,代码来源:DxfRenderer.IProjectExporter.cs
示例5: Draw
public static void Draw(DxfDocument dxf, Location location)
{
Vector3f v1 = new Vector3f(location.X - 2.0f, location.Y - 4.0f, location.Z);
Vector3f v2 = new Vector3f(location.X + 2.0f, location.Y + 4.0f, location.Z);
Layer layer = new Layer("line");
Line line12 = new Line(v1, v2);
line12.Layer = layer;
dxf.AddEntity(line12);
}
开发者ID:Spritutu,项目名称:ntxx,代码行数:10,代码来源:Slash.cs
示例6: Draw
/// <summary>
/// 风向绘制
/// </summary>
/// <param name="dxf"></param>
/// <param name="location"></param>
/// <param name="isRight"></param>
public static void Draw(DxfDocument dxf, Location location, bool isRight)
{
float factor = 0.5f;
Vector3f v1 = new Vector3f();
Vector3f v2 = new Vector3f();
Vector3f v3 = new Vector3f();
Vector3f v4 = new Vector3f();
Vector3f v5 = new Vector3f();
Vector3f v6 = new Vector3f();
Vector3f v7 = new Vector3f();
if (isRight)
{
v1 = new Vector3f(10*factor + location.X, location.Y, location.Z);
v2 = new Vector3f(location.X, location.Y + 10 * factor, location.Z);
v3 = new Vector3f(location.X + 10 * factor, location.Y + 10 * factor, location.Z);
v4 = new Vector3f(location.X + 20 * factor, location.Y + 15 * factor, location.Z);
v5 = new Vector3f(location.X, location.Y + 20 * factor, location.Z);
v6 = new Vector3f(location.X + 10 * factor, location.Y + 20 * factor, location.Z);
v7 = new Vector3f(location.X + 10 * factor, location.Y + 30 * factor, location.Z);
}
else
{
v1 = new Vector3f(10 * factor + location.X, location.Y, location.Z);
v2 = new Vector3f(location.X + 20 * factor, location.Y + 10 * factor, location.Z);
v3 = new Vector3f(location.X + 10 * factor, location.Y + 10 * factor, location.Z);
v4 = new Vector3f(location.X, location.Y + 15 * factor, location.Z);
v5 = new Vector3f(location.X + 20 * factor, location.Y + 20 * factor, location.Z);
v6 = new Vector3f(location.X + 10 * factor, location.Y + 20 * factor, location.Z);
v7 = new Vector3f(location.X + 10 * factor, location.Y + 30 * factor, location.Z);
}
Layer layer = new Layer("line");
Line line23 = new Line(v2, v3);
line23.Layer = layer;
dxf.AddEntity(line23);
Line line56 = new Line(v5, v6);
line56.Layer = layer;
dxf.AddEntity(line56);
Line line14 = new Line(v1, v4);
line14.Layer = layer;
dxf.AddEntity(line14);
Line line74 = new Line(v7, v4);
line74.Layer = layer;
dxf.AddEntity(line74);
Line line25 = new Line(v2, v5);
line25.Layer = layer;
dxf.AddEntity(line25);
Line line71 = new Line(v7, v1);
line71.Layer = layer;
dxf.AddEntity(line71);
}
开发者ID:Spritutu,项目名称:ntxx,代码行数:61,代码来源:Wind.cs
示例7: TopViewConfigure
public TopViewConfigure(List<PictureBoxInfo> imageNameList, DxfDocument dxf, string[] text, float height, float width, float outer_mid_space, float outer_in_space, float barHeight, float barWidth)
{
this.imageNameList = imageNameList;
this.dxf = dxf;
this.text = text;
this.height = height;
this.width = width;
this.outer_mid_space = outer_mid_space;
this.outer_in_space = outer_in_space;
this.barHeight = barHeight;
this.barWidth = barWidth;
}
开发者ID:Spritutu,项目名称:ntxx,代码行数:12,代码来源:TopViewConfigure.cs
示例8: Draw
public static void Draw(DxfDocument dxf, Location location,List<string> configurations)
{
Vector3f confStrVector3f = new Vector3f(location.X + 5.0f, location.Y - 5.0f, location.Z);
TextStyle style = new TextStyle("True type font", "Arial.ttf");
Text text1 = new Text("CONFIGURATION: NOTE: Assembly drawing for overall dimesions, actual door size and handle position may vary",
confStrVector3f, 2.0f, style);
Layer layer = new Layer("text");
text1.Layer = layer;
//text1.Layer.Color.Index = 8;
text1.Alignment = TextAlignment.TopLeft;
dxf.AddEntity(text1);
for (int i = 0; i < configurations.Count(); i++)
{
Vector3f confVector3f = new Vector3f(location.X+10.0f, location.Y - 5.0f * (i + 2), location.Z);
Text text = new Text(configurations[i], confVector3f, 2.0f, style);
text.Layer = layer;
//text.Layer.Color.Index = 8;
text.Alignment = TextAlignment.TopLeft;
dxf.AddEntity(text);
}
}
开发者ID:Spritutu,项目名称:ntxx,代码行数:22,代码来源:Configuration.cs
示例9: DrawEllipseInternal
private void DrawEllipseInternal(DxfDocument doc, Layer layer, bool isFilled, bool isStroked, Test2d.BaseStyle style, ref Test2d.Rect2 rect)
{
var dxfEllipse = CreateEllipse(rect.X, rect.Y, rect.Width, rect.Height);
if (isFilled)
{
var fill = GetColor(style.Fill);
var fillTransparency = GetTransparency(style.Fill);
// TODO: The netDxf does not create hatch for Ellipse with end angle equal to 360.
var bounds =
new List<HatchBoundaryPath>
{
new HatchBoundaryPath(
new List<EntityObject>
{
(Ellipse)dxfEllipse.Clone()
})
};
var hatch = new Hatch(HatchPattern.Solid, bounds, false);
hatch.Layer = layer;
hatch.Color = fill;
hatch.Transparency.Value = fillTransparency;
doc.AddEntity(hatch);
}
if (isStroked)
{
var stroke = GetColor(style.Stroke);
var strokeTansparency = GetTransparency(style.Stroke);
var lineweight = ThicknessToLineweight(style.Thickness);
dxfEllipse.Layer = layer;
dxfEllipse.Color = stroke;
dxfEllipse.Transparency.Value = strokeTansparency;
dxfEllipse.Lineweight.Value = lineweight;
doc.AddEntity(dxfEllipse);
}
}
开发者ID:gitter-badger,项目名称:Test2d,代码行数:42,代码来源:DxfRenderer.cs
示例10: Add
/// <summary>
///
/// </summary>
/// <param name="doc"></param>
/// <param name="container"></param>
private void Add(DxfDocument doc, Test2d.Container container)
{
_pageWidth = container.Width;
_pageHeight = container.Height;
if (container.Template != null)
{
Draw(doc, container.Template, container.Properties, null);
}
Draw(doc, container, container.Properties, null);
}
开发者ID:gitter-badger,项目名称:Test2d,代码行数:17,代码来源:DxfRenderer.cs
示例11: Save
/// <summary>
///
/// </summary>
/// <param name="path"></param>
/// <param name="container"></param>
public void Save(string path, Test2d.Container container)
{
_outputPath = System.IO.Path.GetDirectoryName(path);
var doc = new DxfDocument(DxfVersion.AutoCad2010);
Add(doc, container);
doc.Save(path);
ClearCache(isZooming: false);
}
开发者ID:gitter-badger,项目名称:Test2d,代码行数:13,代码来源:DxfRenderer.cs
示例12: DrawRectangleInternal
private void DrawRectangleInternal(DxfDocument doc, Layer layer, bool isFilled, bool isStroked, Test2d.BaseStyle style, ref Test2d.Rect2 rect)
{
double x = rect.X;
double y = rect.Y;
double w = rect.Width;
double h = rect.Height;
var dxfLine1 = CreateLine(x, y, x + w, y);
var dxfLine2 = CreateLine(x + w, y, x + w, y + h);
var dxfLine3 = CreateLine(x + w, y + h, x, y + h);
var dxfLine4 = CreateLine(x, y + h, x, y);
if (isFilled)
{
var fill = GetColor(style.Fill);
var fillTransparency = GetTransparency(style.Fill);
var bounds =
new List<HatchBoundaryPath>
{
new HatchBoundaryPath(
new List<EntityObject>
{
(Line)dxfLine1.Clone(),
(Line)dxfLine2.Clone(),
(Line)dxfLine3.Clone(),
(Line)dxfLine4.Clone()
})
};
var hatch = new Hatch(HatchPattern.Solid, bounds, false);
hatch.Layer = layer;
hatch.Color = fill;
hatch.Transparency.Value = fillTransparency;
doc.AddEntity(hatch);
}
if (isStroked)
{
var stroke = GetColor(style.Stroke);
var strokeTansparency = GetTransparency(style.Stroke);
var lineweight = ThicknessToLineweight(style.Thickness);
dxfLine1.Layer = layer;
dxfLine1.Color = stroke;
dxfLine1.Transparency.Value = strokeTansparency;
dxfLine1.Lineweight.Value = lineweight;
dxfLine2.Layer = layer;
dxfLine2.Color = stroke;
dxfLine2.Transparency.Value = strokeTansparency;
dxfLine2.Lineweight.Value = lineweight;
dxfLine3.Layer = layer;
dxfLine3.Color = stroke;
dxfLine3.Transparency.Value = strokeTansparency;
dxfLine3.Lineweight.Value = lineweight;
dxfLine4.Layer = layer;
dxfLine4.Color = stroke;
dxfLine4.Transparency.Value = strokeTansparency;
dxfLine4.Lineweight.Value = lineweight;
doc.AddEntity(dxfLine1);
doc.AddEntity(dxfLine2);
doc.AddEntity(dxfLine3);
doc.AddEntity(dxfLine4);
}
}
开发者ID:gitter-badger,项目名称:Test2d,代码行数:70,代码来源:DxfRenderer.cs
示例13: doDXF
static void doDXF(List<Polyline3dVertex> vertexes, double[] x)
{
// create a dxf for those who want to "see" the calibration
DxfDocument dxf = new DxfDocument();
Polyline3d polyline = new Polyline3d(vertexes, true);
polyline.Layer = new Layer("polyline3d");
polyline.Layer.Color.Index = 24;
dxf.AddEntity(polyline);
var pnt = new Point(new Vector3f(-(float) x[0], -(float) x[1], -(float) x[2]));
pnt.Layer = new Layer("new offset");
pnt.Layer.Color.Index = 21;
dxf.AddEntity(pnt);
dxf.Save("magoffset.dxf", DxfVersion.AutoCad2000);
log.Info("dxf Done " + DateTime.Now);
}
开发者ID:ans10528,项目名称:MissionPlanner-MissionPlanner1.3.34,代码行数:19,代码来源:MagCalib.cs
示例14: writeRepresentDoorBarRectangle
//画表示门闩的小矩形
public static void writeRepresentDoorBarRectangle(DxfDocument doc, Location location, string[] text, float height, float width, float outer_mid_space, float outer_in_space, float barHeight, float barWidth)
{
Layer representDoorBarRectangleLayer = new Layer("RepresentDoorBarRectangle");
Line bottomLine = new Line(new Vector3f(location.X, location.Y, location.Z), new Vector3f(location.X + barWidth, location.Y, location.Z));
bottomLine.Layer = representDoorBarRectangleLayer;
Line leftLine = new Line(new Vector3f(location.X, location.Y, location.Z), new Vector3f(location.X, location.Y + barHeight, location.Z));
leftLine.Layer = representDoorBarRectangleLayer;
Line topLine = new Line(new Vector3f(location.X, location.Y + barHeight, location.Z), new Vector3f(location.X + barWidth, location.Y + barHeight, location.Z));
topLine.Layer = representDoorBarRectangleLayer;
Line rightLine = new Line(new Vector3f(location.X + barWidth, location.Y + barHeight, location.Z), new Vector3f(location.X + barWidth, location.Y, location.Z));
rightLine.Layer = representDoorBarRectangleLayer;
//内部折线
Line upLine = new Line(new Vector3f(location.X + barWidth / 2-(outer_in_space-outer_mid_space)/2, location.Y + barHeight, location.Z), new Vector3f(location.X + barWidth / 2-(outer_in_space-outer_mid_space)/2, location.Y + barHeight / 2, location.Z));
upLine.Layer = representDoorBarRectangleLayer;
Line midLine = new Line(new Vector3f(location.X + barWidth / 2 - (outer_in_space - outer_mid_space) / 2, location.Y + barHeight / 2, location.Z), new Vector3f(location.X + barWidth / 2 + (outer_in_space - outer_mid_space) / 2,location.Y+barHeight/2,location.Z));
midLine.Layer = representDoorBarRectangleLayer;
Line downLine = new Line(new Vector3f(location.X + barWidth / 2 + (outer_in_space - outer_mid_space) / 2, location.Y + barHeight / 2, location.Z), new Vector3f(location.X+barWidth/2+(outer_in_space-outer_mid_space)/2, location.Y, location.Z));
downLine.Layer = representDoorBarRectangleLayer;
doc.AddEntity(bottomLine);
doc.AddEntity(leftLine);
doc.AddEntity(topLine);
doc.AddEntity(rightLine);
doc.AddEntity(upLine);
doc.AddEntity(midLine);
doc.AddEntity(downLine);
}
开发者ID:Spritutu,项目名称:ntxx,代码行数:28,代码来源:DoorRectangle.cs
示例15: Draw
/// <summary>
/// 绘制左下角区域的Section块
/// </summary>
/// <param name="dxf"></param>
/// <param name="location"></param>
/// <param name="configurations"></param>
public static void Draw(DxfDocument dxf, Location location,SectionEntity sectionEntity)
{
float factor=0.6f;
Vector3f v1 = new Vector3f(location.X, location.Y + 40.0f*factor, location.Z);
Vector3f v2 = new Vector3f(location.X + 50.0f * factor, location.Y + 40.0f * factor, location.Z);
Vector3f v3 = new Vector3f(location.X + 90.0f * factor, location.Y + 40.0f * factor, location.Z);
Vector3f v4 = new Vector3f(location.X + 140.0f * factor, location.Y + 40.0f * factor, location.Z);
Vector3f v5 = new Vector3f(location.X, location.Y + 50.0f * factor, location.Z);
Vector3f v6 = new Vector3f(location.X + 140.0f * factor, location.Y + 50.0f * factor, location.Z);
Vector3f v7 = new Vector3f(location.X, location.Y + 60.0f * factor, location.Z);
Vector3f v8 = new Vector3f(location.X + 140.0f * factor, location.Y + 60.0f * factor, location.Z);
Vector3f v9 = new Vector3f(location.X, location.Y + 70.0f * factor, location.Z);
Vector3f v10 = new Vector3f(location.X + 50.0f * factor, location.Y + 70.0f * factor, location.Z);
Vector3f v11 = new Vector3f(location.X + 90.0f * factor, location.Y + 70.0f * factor, location.Z);
Vector3f v12 = new Vector3f(location.X + 140.0f * factor, location.Y + 70.0f * factor, location.Z);
Layer layer = new Layer("line");
//横向四道
Line line14 = new Line(v1, v4);
line14.Layer = layer;
dxf.AddEntity(line14);
Line line56 = new Line(v5, v6);
line56.Layer = layer;
dxf.AddEntity(line56);
Line line78 = new Line(v7, v8);
line78.Layer = layer;
dxf.AddEntity(line78);
Line line912 = new Line(v9, v12);
line912.Layer = layer;
dxf.AddEntity(line912);
//纵向四道
Line line91 = new Line(v9, v1);
line91.Layer = layer;
dxf.AddEntity(line91);
Line line210 = new Line(v2, v10);
line210.Layer = layer;
dxf.AddEntity(line210);
Line line311 = new Line(v3, v11);
line311.Layer = layer;
dxf.AddEntity(line311);
Line line412 = new Line(v4, v12);
line412.Layer = layer;
dxf.AddEntity(line412);
TextStyle style = new TextStyle("True type font", "Arial.ttf");
Vector3f vt1 = new Vector3f(v1.X+1.0f, v1.Y+2.5f, v1.Z);
Text t1 = new Text("COIL", vt1, 2.0f, style);
t1.Layer = layer;
t1.Alignment = TextAlignment.TopLeft;
dxf.AddEntity(t1);
Vector3f vt2 = new Vector3f(v2.X + 1.0f, v2.Y + 2.5f, v2.Z);
Text t2 = new Text("CLF", vt2, 2.0f, style);
t2.Layer = layer;
t2.Alignment = TextAlignment.TopLeft;
dxf.AddEntity(t2);
Vector3f vt3 = new Vector3f(v3.X + 1.0f, v3.Y + 2.5f, v3.Z);
Text t3 = new Text(sectionEntity.CoolValue, vt3, 2.0f, style);
t3.Layer = layer;
t3.Alignment = TextAlignment.TopLeft;
dxf.AddEntity(t3);
Vector3f vt4 = new Vector3f(v5.X + 1.0f, v5.Y + 2.5f, v5.Z);
Text t4 = new Text("FILTER", vt4, 2.0f, style);
t4.Layer = layer;
t4.Alignment = TextAlignment.TopLeft;
dxf.AddEntity(t4);
Vector3f vt5 = new Vector3f(v2.X + 1.0f, v5.Y + 2.5f, v5.Z);
Text t5 = new Text("FTA", vt5, 2.0f, style);
t5.Layer = layer;
t5.Alignment = TextAlignment.TopLeft;
dxf.AddEntity(t5);
Vector3f vt6 = new Vector3f(v3.X + 1.0f, v5.Y + 2.5f, v5.Z);
Text t6 = new Text(sectionEntity.FilterValue, vt6, 2.0f, style);
t6.Layer = layer;
t6.Alignment = TextAlignment.TopLeft;
dxf.AddEntity(t6);
Vector3f vt7 = new Vector3f(v7.X + 1.0f, v7.Y + 2.5f, v7.Z);
Text t7 = new Text("SECTION", vt7, 2.0f, style);
//.........这里部分代码省略.........
开发者ID:Spritutu,项目名称:ntxx,代码行数:101,代码来源:Section.cs
示例16: writeWholeMachine
//画完整的带支架的设备矩形框
public static void writeWholeMachine(DxfDocument dxf, Location location, string[] text, float height, float width, float outer_mid_space, float outer_in_space, float barHeight, float barWidth,string upOrDownLayer)
{
writeDoorRectangle(dxf,location,text,height,width,outer_mid_space,outer_in_space);
//画小支架
if (upOrDownLayer.Equals("downLayer"))
{
//左下角
writeOuterDoorRectangle(dxf, new Location(location.X, location.Y - outer_in_space, location.Z), outer_in_space, outer_in_space - outer_mid_space);
//右下角
writeOuterDoorRectangle(dxf, new Location(location.X + width + outer_mid_space - outer_in_space, location.Y - outer_in_space, location.Z), outer_in_space, outer_in_space - outer_mid_space);
}
}
开发者ID:Spritutu,项目名称:ntxx,代码行数:13,代码来源:DoorRectangle.cs
示例17: writeTopViewRectangle
//画带有四个小矩形的俯视图矩形
public static void writeTopViewRectangle(DxfDocument dxf, Location location, string[] text, float height, float width, float outer_mid_space, float outer_in_space)
{
//outer_in_space模拟height,outer_in_space - outer_mid_space模拟width
//主要矩形
writeOuterDoorRectangle(dxf, location, height, width);
//左上角矩形
writeOuterDoorRectangle(dxf, new Location(location.X, location.Y + height, location.Z), outer_in_space, outer_in_space - outer_mid_space);
//右上角
writeOuterDoorRectangle(dxf, new Location(location.X + width - outer_in_space + outer_mid_space, location.Y + height, location.Z), outer_in_space, outer_in_space - outer_mid_space);
//左下角
writeOuterDoorRectangle(dxf, new Location(location.X, location.Y - outer_in_space, location.Z), outer_in_space, outer_in_space - outer_mid_space);
//右下角
writeOuterDoorRectangle(dxf, new Location(location.X + width - outer_in_space + outer_mid_space, location.Y - outer_in_space, location.Z), outer_in_space, outer_in_space - outer_mid_space);
}
开发者ID:Spritutu,项目名称:ntxx,代码行数:15,代码来源:DoorRectangle.cs
示例18: Load
public void Load(string filePath)
{
_dxf = new DxfDocument();
_dxf.Load(filePath);
foreach (netDxf.Tables.LineType lineType in _dxf.LineTypes)
{
_lineTypeDictionary.Add(lineType, PicGraphics.LT.LT_CUT);
_lineType2GrpDictionary.Add(lineType, 0);
}
}
开发者ID:minrogi,项目名称:PLMPack,代码行数:11,代码来源:PicLoaderDes.cs
示例19: writeWholeSingleDoor
//画完整的一个单门(门闩,把手,支架)
public static void writeWholeSingleDoor(DxfDocument dxf, Location location, string[] text, float height, float width, float outer_mid_space, float outer_in_space, float barHeight, float barWidth,string upOrDownLayer)
{
writeDoorBarRectangle(dxf, location, text, height, width, outer_mid_space, outer_in_space, barHeight, barWidth);
float downLeftX=location.X+outer_mid_space-barWidth/2+(outer_in_space-outer_mid_space)/2;
float downLeftY=location.Y + height / 4;
writeRepresentDoorBarRectangle(dxf, new Location(downLeftX,downLeftY , location.Z), text, height, width, outer_mid_space, outer_in_space, barHeight, barWidth);
float upLeftX = downLeftX;
float upLeftY = location.Y + 3 * height / 4 - barHeight;
writeRepresentDoorBarRectangle(dxf, new Location(upLeftX,upLeftY , location.Z), text, height, width, outer_mid_space, outer_in_space, barHeight, barWidth);
//画小支架
if (upOrDownLayer.Equals("downLayer"))
{
//左下角
writeOuterDoorRectangle(dxf, new Location(location.X, location.Y - outer_in_space, location.Z), outer_in_space, outer_in_space - outer_mid_space);
//右下角
writeOuterDoorRectangle(dxf, new Location(location.X + width + outer_mid_space - outer_in_space, location.Y - outer_in_space, location.Z), outer_in_space, outer_in_space - outer_mid_space);
}
//画门把手
Handle.Draw(dxf, new Location(location.X + 3 * width / 4, location.Y + 3 * height / 4 - barHeight, location.Z));
Handle.Draw(dxf, new Location(location.X + 3 * width / 4, location.Y + height / 4, location.Z));
}
开发者ID:Spritutu,项目名称:ntxx,代码行数:23,代码来源:DoorRectangle.cs
示例20: WriteProject
public void WriteProject(WaveguideDesignerProjectData project)
{
if( project == null ) return;
Type type;
EntityObject obj = null;
DxfDocument doc = new DxfDocument();
doc.Name = project.Name;
Layer dxfLayer;
LayerData layerData;
foreach( VirtualLayer vLayer in project.VirtualGraphics.Layers )
{
layerData = null;
foreach( LayerData tmp in project.Layers )
if( tmp.VirtualLayer == vLayer )
{
layerData = tmp;
break;
}
if( layerData == null ) continue;
dxfLayer = new Layer( layerData.Name );
dxfLayer.Color.Index = (short)layerData.LayerNumber;
doc.Layers.Add( dxfLayer );
foreach( VirtualShapeBase vShape in vLayer.Shapes )
{
type = vShape.GetType();
if( type == typeof( VirtualRectangle ) )
{
VirtualRectangle rect = (VirtualRectangle)vShape;
Polyline dxfrect = new Polyline();
obj = new Polyline();
dxfrect.IsClosed = true;
dxfrect.Vertexes.Add( new PolylineVertex( rect.Location.X, rect.Location.Y, 0 ) );
dxfrect.Vertexes.Add( new PolylineVertex( rect.Location.X + rect.Size.W, rect.Location.Y, 0 ) );
dxfrect.Vertexes.Add( new PolylineVertex( rect.Location.X + rect.Size.W, rect.Location.Y + rect.Size.H, 0 ) );
dxfrect.Vertexes.Add( new PolylineVertex( rect.Location.X, rect.Location.Y + rect.Size.H, 0 ) );
dxfrect.Vertexes.Add( new PolylineVertex( rect.Location.X, rect.Location.Y, 0 ) );
obj = dxfrect;
}
else if( type == typeof( VirtualPolygon ) )
{
VirtualPolygon poly = (VirtualPolygon)vShape;
Polyline dxfpoly = new Polyline();
dxfpoly.IsClosed = true;
foreach( PointD p in poly.Vertices )
dxfpoly.Vertexes.Add( conv( p ) );
dxfpoly.Vertexes.Add( conv( poly.Vertices[0] ) );
obj = dxfpoly;
}
else if( type == typeof( VirtualEllipse ) )
{
VirtualEllipse elli = (VirtualEllipse)vShape;
Ellipse dxfelli = new Ellipse();
dxfelli.Center = new netDxf.Vector3( elli.Center.X, elli.Center.Y, 0 );
dxfelli.StartAngle = 0;
dxfelli.EndAngle = 360;
dxfelli.MajorAxis = Math.Max( elli.Radius.W, elli.Radius.H );
dxfelli.MinorAxis = Math.Min( elli.Radius.W, elli.Radius.H );
dxfelli.Rotation = elli.Radius.W >= elli.Radius.H ? 0 : 90;
obj = dxfelli;
}
else if( type == typeof( VirtualPie ) )
{
VirtualPie pie = (VirtualPie)vShape;
Ellipse dxfelli = new Ellipse();
dxfelli.Center = new netDxf.Vector3( pie.Center.X, pie.Center.Y, 0 );
dxfelli.StartAngle = pie.StartAngle;
dxfelli.EndAngle = pie.EndAngle;
dxfelli.MajorAxis = Math.Max( pie.Radius.W, pie.Radius.H );
dxfelli.MinorAxis = Math.Min( pie.Radius.W, pie.Radius.H );
dxfelli.Rotation = pie.Radius.W >= pie.Radius.H ? 0 : 90;
obj = dxfelli;
}
else obj = null;
if( obj == null )
continue;
obj.Layer = dxfLayer;
doc.AddEntity( obj );
}
}
doc.Save( FileName );
}
开发者ID:DaishiNakase,项目名称:WaveguideDesigner,代码行数:87,代码来源:DxfWriter.cs
注:本文中的netDxf.DxfDocument类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论