?? dxfexport.cs
字號:
}
protected void AddS(string[] S)
{
for (int i = 0; i < S.Length; i++)
{
this.current.Add(S[i]);
}
}
public void AddSolid(DXFData Data)
{
DXFSolid solid = new DXFSolid(Data);
solid.Layer = this.nameCurrentLayer;
if (this.blockMode)
{
solid.ExportAsDXF(this);
}
else
{
this.figuresList.Add(solid);
}
}
public void AddString(int code, string str)
{
string str2 = this.SpecialFormat(code);
this.current.Add(str2);
this.current.Add(str);
}
public void AddText(DXFData Data)
{
DXFText text = new DXFText(Data);
text.Layer = this.nameCurrentLayer;
if (this.blockMode)
{
text.ExportAsDXF(this);
}
else
{
this.figuresList.Add(text);
}
}
public void AddThickness(DXFData Data)
{
if (autoCADVer == AutoCADVersion.R2000)
{
int num;
if (Data.text != "")
{
this.current.Add(" 6");
this.current.Add(Data.text);
}
try
{
if (use01MM)
{
num = (int)Math.Round((double)Data.thickness);
}
else
{
num = ((int)Math.Round((double)Data.thickness)) * 10;
if (this.penWidthRatio > 0f)
{
num = (int)Math.Round((double)((Data.thickness * 100f) * this.penWidthRatio));
}
}
}
catch
{
num = 100;
}
if (num >= 5)
{
if (num >= 0xd3)
{
num = 0xd3;
}
else
{
for (int i = 0; i < (DXFLineWeights.Length - 1); i++)
{
if (num < DXFLineWeights[i])
{
num = DXFLineWeights[i - 1];
break;
}
}
this.AddInt(370, num);
}
}
}
}
public void AddVertex(DXFPoint P)
{
this.Add3DPoint(10, P);
}
public void BeginBlock(string aName)
{
this.blockMode = true;
this.block = aName;
if (aName == "")
{
this.current = this.entities;
}
else
{
int index = this.blocks.IndexOf(aName);
if (index >= 0)
{
this.current = (ArrayList)this.blocks[index];
}
else
{
this.current = this.blkRecs;
this.AddName("BLOCK_RECORD", "AcDbBlockTableRecord");
this.blkRecs.Add(" 2");
this.blkRecs.Add(aName);
this.current = new ArrayList();
this.blocks.Add(this.current);
this.AddName("BLOCK", "AcDbBlockBegin");
this.current.Add(" 2");
this.current.Add(aName);
this.current.Add(" 10");
this.current.Add("0");
this.current.Add(" 20");
this.current.Add("0");
this.current.Add(" 70");
this.current.Add("0");
}
}
}
public void BeginPoly(DXFData Data, int aCount)
{
this.AddName("LWPOLYLINE", "AcDbPolyline");
this.AddColor(Data);
this.AddThickness(Data);
this.AddInt(90, aCount);
this.AddInt(70, Data.flags);
if (Data.globalWidth != 0f)
{
this.AddFloat(0x2b, Data.globalWidth);
}
}
public void Clear()
{
this.entities.Clear();
this.blocks.Clear();
this.lTypes.Clear();
this.blkRecs.Clear();
this.current = this.entities;
this.handle = 0x20;
}
public static int ColorToDXF(Color Value)
{
byte[] buffer = new byte[] {
0, 1, 3, 2, 5, 6, 4, 0, 1, 0xfb, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 0x21, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 0x66, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 50,
1, 1, 1, 1, 1, 1, 1, 1, 1, 0xfb, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0xfc, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 0xfd, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0xab, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0xfe
};
switch (Value.Name)
{
case "Black":
case "ff000000":
if (!alternativeBlack)
{
return 7;
}
return 250;
case "Maroon":
case "ff800000":
return 14;
case "Green":
case "ff008000":
return 0x4a;
case "Olive":
case "ff808000":
return 0x2c;
case "Navy":
case "ff000080":
return 0x9a;
case "Purple":
case "ff800080":
return 0xe0;
case "Teal":
case "ff008080":
return 12;
case "Gray":
case "ff808080":
return 8;
case "Silver":
case "ffc0c0c0":
return 9;
case "Red":
case "ffff0000":
return 1;
case "Lime":
case "ff00ff00":
return 3;
case "Yellow":
case "ffffff00":
return 2;
case "Blue":
case "ff0000ff":
return 5;
case "Fuchsia":
case "ffff00ff":
return 6;
case "Aquamarine":
case "ff7fffd4":
return 4;
case "White":
case "ffffffff":
return 0xff;
case "0":
return 0;
}
int num = (Value.R + (Value.G << 8)) + (Value.B << 0x10);
return buffer[(((num & 0xe0) >> 5) + ((num & 0xe000) >> 10)) + ((num & 0xc00000) >> 0x10)];
}
public void EndBlock()
{
this.blockMode = false;
this.BeginBlock("");
}
public void EndDraw()
{
}
public static string FontToStr(Font FontV, string S)
{
string str = ";" + S;
if (FontV.Style == FontStyle.Italic)
{
str = "|i1" + str;
}
if (FontV.Style == FontStyle.Bold)
{
str = "|b1" + str;
}
return (@"\f" + FontV.Name + str);
}
public static string GetPourStr(string S)
{
StringBuilder builder = new StringBuilder();
builder.Append(S.ToCharArray());
builder.Remove(0, S.IndexOf(";") + 1);
if (builder.ToString().IndexOf(@"\L") == 0)
{
builder.Remove(0, 2);
}
return builder.ToString();
}
public string GetStrAutoCADVer()
{
if (autoCADVer == AutoCADVersion.R14)
{
return "AC1014";
}
if (autoCADVer == AutoCADVersion.R2000)
{
return "AC1015";
}
return "Err";
}
public void Insert(DXFData aData)
{
this.AddName("INSERT", "AcDbBlockReference");
this.current.Add(" 2");
this.current.Add(aData.text);
this.Add3DPoint(10, aData.point);
this.AddColor(aData);
if (aData.scale.X != 1f)
{
this.AddFloat(0x29, aData.scale.X);
}
if (aData.scale.Y != 1f)
{
this.AddFloat(0x2a, aData.scale.Y);
}
if (aData.rotation != 0f)
{
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -