hytos / DTI_PID / OdReadExMgd / OdReadExMgd.cs @ f5db2097
이력 | 보기 | 이력해설 | 다운로드 (197 KB)
1 |
/////////////////////////////////////////////////////////////////////////////// |
---|---|
2 |
// Copyright (C) 2002-2019, Open Design Alliance (the "Alliance"). |
3 |
// All rights reserved. |
4 |
// |
5 |
// This software and its documentation and related materials are owned by |
6 |
// the Alliance. The software may only be incorporated into application |
7 |
// programs owned by members of the Alliance, subject to a signed |
8 |
// Membership Agreement and Supplemental Software License Agreement with the |
9 |
// Alliance. The structure and organization of this software are the valuable |
10 |
// trade secrets of the Alliance and its suppliers. The software is also |
11 |
// protected by copyright law and international treaty provisions. Application |
12 |
// programs incorporating this software must include the following statement |
13 |
// with their copyright notices: |
14 |
// |
15 |
// This application incorporates Open Design Alliance software pursuant to a license |
16 |
// agreement with Open Design Alliance. |
17 |
// Open Design Alliance Copyright (C) 2002-2019 by Open Design Alliance. |
18 |
// All rights reserved. |
19 |
// |
20 |
// By use of this software, its documentation or related materials, you |
21 |
// acknowledge and accept the above terms. |
22 |
/////////////////////////////////////////////////////////////////////////////// |
23 |
using System; |
24 |
using System.Collections.Generic; |
25 |
using System.Text; |
26 |
using System.IO; |
27 |
using System.Xml; |
28 |
using Teigha.DatabaseServices; |
29 |
using Teigha.Geometry; |
30 |
using Teigha.GraphicsInterface; |
31 |
using Teigha.Colors; |
32 |
using Teigha; |
33 |
// note that GetObject doesn't work in Acad 2009, so we use "obsolete" Open instead |
34 |
#pragma warning disable 618 |
35 |
|
36 |
namespace OdReadExMgd |
37 |
{ |
38 |
class DbDumper |
39 |
{ |
40 |
public DbDumper() { } |
41 |
|
42 |
static string toDegreeString(double val) |
43 |
{ |
44 |
return (val * 180.0 / Math.PI) + "d"; |
45 |
} |
46 |
static string toHexString(int val) |
47 |
{ |
48 |
return string.Format("0{0:X}", val); |
49 |
} |
50 |
static string toArcSymbolTypeString(int val) |
51 |
{ |
52 |
switch (val) |
53 |
{ |
54 |
case 0: return "Precedes text"; |
55 |
case 1: return "Above text"; |
56 |
case 2: return "None"; |
57 |
} |
58 |
return "???"; |
59 |
} |
60 |
/************************************************************************/ |
61 |
/* Shorten a path with ellipses. */ |
62 |
/************************************************************************/ |
63 |
static string shortenPath(string Inpath, int maxPath) |
64 |
{ |
65 |
string path = Inpath; |
66 |
/**********************************************************************/ |
67 |
/* If the path fits, just return it */ |
68 |
/**********************************************************************/ |
69 |
if (path.Length <= maxPath) |
70 |
{ |
71 |
return path; |
72 |
} |
73 |
/**********************************************************************/ |
74 |
/* If there's no backslash, just truncate the path */ |
75 |
/**********************************************************************/ |
76 |
int lastBackslash = path.LastIndexOf('\\'); |
77 |
if (lastBackslash < 0) |
78 |
{ |
79 |
return path.Substring(0, maxPath - 3) + "..."; |
80 |
} |
81 |
|
82 |
/**********************************************************************/ |
83 |
/* Shorten the front of the path */ |
84 |
/**********************************************************************/ |
85 |
int fromLeft = (lastBackslash - 3) - (path.Length - maxPath); |
86 |
// (12 - 3) - (19 - 10) = 9 - 9 = 0 |
87 |
if ((lastBackslash <= 3) || (fromLeft < 1)) |
88 |
{ |
89 |
path = "..." + path.Substring(lastBackslash); |
90 |
} |
91 |
else |
92 |
{ |
93 |
path = path.Substring(0, fromLeft) + "..." + path.Substring(lastBackslash); |
94 |
} |
95 |
|
96 |
/**********************************************************************/ |
97 |
/* Truncate the path */ |
98 |
/**********************************************************************/ |
99 |
if (path.Length > maxPath) |
100 |
{ |
101 |
path = path.Substring(0, maxPath - 3) + "..."; |
102 |
} |
103 |
|
104 |
return path; |
105 |
} |
106 |
static string shortenPath(string Inpath) |
107 |
{ |
108 |
return shortenPath(Inpath, 40); |
109 |
} |
110 |
|
111 |
/************************************************************************/ |
112 |
/* Output a string in the form */ |
113 |
/* leftString:. . . . . . . . . . . .rightString */ |
114 |
/************************************************************************/ |
115 |
static void writeLine(int indent, object leftString, object rightString, int colWidth) |
116 |
{ |
117 |
string spaces = " "; |
118 |
string leader = ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "; |
119 |
|
120 |
const int tabSize = 2; |
121 |
|
122 |
/**********************************************************************/ |
123 |
/* Indent leftString with spaces characters */ |
124 |
/**********************************************************************/ |
125 |
string newleftString = spaces.Substring(0, tabSize * indent) + leftString.ToString(); |
126 |
|
127 |
/**********************************************************************/ |
128 |
/* If rightString is not specified, just output the indented */ |
129 |
/* leftString. Otherwise, fill the space between leftString and */ |
130 |
/* rightString with leader characters. */ |
131 |
/**********************************************************************/ |
132 |
if (rightString == null || ((rightString is string) && ((string)rightString) == "")) |
133 |
{ |
134 |
Console.WriteLine(newleftString); |
135 |
} |
136 |
else |
137 |
{ |
138 |
int leaders = colWidth - newleftString.Length; |
139 |
if (leaders > 0) |
140 |
{ |
141 |
Console.WriteLine(newleftString + leader.Substring(newleftString.Length, leaders) + rightString.ToString()); |
142 |
} |
143 |
else |
144 |
{ |
145 |
Console.WriteLine(newleftString + ' ' + rightString.ToString()); |
146 |
} |
147 |
} |
148 |
} |
149 |
static void writeLine(int indent, object leftString, object rightString) |
150 |
{ |
151 |
writeLine(indent, leftString, rightString, 38); |
152 |
} |
153 |
static void writeLine(int indent, object leftString) |
154 |
{ |
155 |
writeLine(indent, leftString, null, 38); |
156 |
} |
157 |
static void writeLine() |
158 |
{ |
159 |
Console.WriteLine(); |
160 |
} |
161 |
|
162 |
static void dumpEntityData(Entity pEnt, int indent, XmlNode node) |
163 |
{ |
164 |
if (node != null) |
165 |
{ |
166 |
try |
167 |
{ |
168 |
Extents3d ext = pEnt.GeometricExtents; |
169 |
|
170 |
XmlAttribute MinExtentsAttr = Program.xml.CreateAttribute("MinExtents"); |
171 |
MinExtentsAttr.Value = ext.MinPoint.ToString(); |
172 |
node.Attributes.SetNamedItem(MinExtentsAttr); |
173 |
|
174 |
XmlAttribute MaxExtentsAttr = Program.xml.CreateAttribute("MaxExtents"); |
175 |
MaxExtentsAttr.Value = ext.MaxPoint.ToString(); |
176 |
node.Attributes.SetNamedItem(MaxExtentsAttr); |
177 |
} |
178 |
catch (System.Exception) |
179 |
{ |
180 |
} |
181 |
|
182 |
XmlAttribute LayerAttr = Program.xml.CreateAttribute("Layer"); |
183 |
LayerAttr.Value = pEnt.Layer; |
184 |
node.Attributes.SetNamedItem(LayerAttr); |
185 |
|
186 |
writeLine(indent, "Color Index", pEnt.ColorIndex); |
187 |
writeLine(indent, "Color", pEnt.Color); |
188 |
|
189 |
XmlAttribute LinetypeAttr = Program.xml.CreateAttribute("Linetype"); |
190 |
LinetypeAttr.Value = pEnt.Linetype; |
191 |
node.Attributes.SetNamedItem(LinetypeAttr); |
192 |
|
193 |
writeLine(indent, "LTscale", pEnt.LinetypeScale); |
194 |
writeLine(indent, "Lineweight", pEnt.LineWeight); |
195 |
writeLine(indent, "Plot Style", pEnt.PlotStyleName); |
196 |
writeLine(indent, "Transparency Method", pEnt.Transparency); |
197 |
writeLine(indent, "Visibility", pEnt.Visible); |
198 |
writeLine(indent, "Planar", pEnt.IsPlanar); |
199 |
|
200 |
if (pEnt.IsPlanar) |
201 |
{ |
202 |
try |
203 |
{ |
204 |
CoordinateSystem3d cs = (CoordinateSystem3d)pEnt.GetPlane().GetCoordinateSystem(); |
205 |
writeLine(indent + 1, "Origin", cs.Origin); |
206 |
writeLine(indent + 1, "u-Axis", cs.Xaxis); |
207 |
writeLine(indent + 1, "v-Axis", cs.Yaxis); |
208 |
} |
209 |
catch (System.Exception ex) |
210 |
{ |
211 |
writeLine(indent + 1, "pEnt.GetPlane().GetCoordinateSystem() failed", ex.Message); |
212 |
} |
213 |
} |
214 |
} |
215 |
} |
216 |
|
217 |
/************************************************************************/ |
218 |
/* Dump Text data */ |
219 |
/************************************************************************/ |
220 |
static XmlNode dumpTextData(DBText pText, int indent, XmlNode node) |
221 |
{ |
222 |
XmlNode TextNode = null; |
223 |
/// write text information to xml file |
224 |
if (node != null) |
225 |
{ |
226 |
TextNode = Program.xml.CreateElement(pText.GetRXClass().Name); |
227 |
|
228 |
XmlAttribute XAttr = Program.xml.CreateAttribute("X"); |
229 |
XAttr.Value = pText.Position.X.ToString(); |
230 |
TextNode.Attributes.SetNamedItem(XAttr); |
231 |
|
232 |
XmlAttribute YAttr = Program.xml.CreateAttribute("Y"); |
233 |
YAttr.Value = pText.Position.Y.ToString(); |
234 |
TextNode.Attributes.SetNamedItem(YAttr); |
235 |
|
236 |
TextNode.InnerText = pText.TextString.Replace("%%U", ""); |
237 |
|
238 |
XmlAttribute AngleAttr = Program.xml.CreateAttribute("Angle"); |
239 |
AngleAttr.Value = pText.Rotation.ToString(); |
240 |
TextNode.Attributes.SetNamedItem(AngleAttr); |
241 |
|
242 |
XmlAttribute WidthAttr = Program.xml.CreateAttribute("Width"); |
243 |
WidthAttr.Value = String.Format("{0}", pText.WidthFactor * pText.Height * pText.TextString.Length); |
244 |
TextNode.Attributes.SetNamedItem(WidthAttr); |
245 |
|
246 |
XmlAttribute HeightAttr = Program.xml.CreateAttribute("Height"); |
247 |
HeightAttr.Value = pText.Height.ToString(); |
248 |
TextNode.Attributes.SetNamedItem(HeightAttr); |
249 |
|
250 |
XmlAttribute WidthFactorAttr = Program.xml.CreateAttribute("WidthFactor"); |
251 |
WidthFactorAttr.Value = pText.WidthFactor.ToString(); |
252 |
TextNode.Attributes.SetNamedItem(WidthFactorAttr); |
253 |
|
254 |
XmlAttribute IsDefaultAlignmentAttr = Program.xml.CreateAttribute("IsDefaultAlignment"); |
255 |
IsDefaultAlignmentAttr.Value = pText.IsDefaultAlignment.ToString(); |
256 |
TextNode.Attributes.SetNamedItem(IsDefaultAlignmentAttr); |
257 |
|
258 |
XmlAttribute AlignmentPointAttr = Program.xml.CreateAttribute("AlignmentPoint"); |
259 |
AlignmentPointAttr.Value = pText.AlignmentPoint.ToString(); |
260 |
TextNode.Attributes.SetNamedItem(AlignmentPointAttr); |
261 |
|
262 |
XmlAttribute HorizontalModeAttr = Program.xml.CreateAttribute("HorizontalMode"); |
263 |
HorizontalModeAttr.Value = pText.HorizontalMode.ToString(); |
264 |
TextNode.Attributes.SetNamedItem(HorizontalModeAttr); |
265 |
|
266 |
XmlAttribute VerticalModeAttr = Program.xml.CreateAttribute("VerticalMode"); |
267 |
VerticalModeAttr.Value = pText.VerticalMode.ToString(); |
268 |
TextNode.Attributes.SetNamedItem(VerticalModeAttr); |
269 |
|
270 |
XmlAttribute IsMirroredInXAttr = Program.xml.CreateAttribute("IsMirroredInX"); |
271 |
IsMirroredInXAttr.Value = pText.IsMirroredInX.ToString(); |
272 |
TextNode.Attributes.SetNamedItem(IsMirroredInXAttr); |
273 |
|
274 |
XmlAttribute IsMirroredInYAttr = Program.xml.CreateAttribute("IsMirroredInY"); |
275 |
IsMirroredInYAttr.Value = pText.IsMirroredInY.ToString(); |
276 |
TextNode.Attributes.SetNamedItem(IsMirroredInYAttr); |
277 |
|
278 |
XmlAttribute ObliqueAttr = Program.xml.CreateAttribute("Oblique"); |
279 |
ObliqueAttr.Value = pText.Oblique.ToString(); |
280 |
TextNode.Attributes.SetNamedItem(ObliqueAttr); |
281 |
|
282 |
XmlAttribute TextStyleAttr = Program.xml.CreateAttribute("TextStyle"); |
283 |
TextStyleAttr.Value = pText.TextStyleName; |
284 |
TextNode.Attributes.SetNamedItem(TextStyleAttr); |
285 |
|
286 |
XmlAttribute NormalAttr = Program.xml.CreateAttribute("Normal"); |
287 |
NormalAttr.Value = pText.Normal.ToString(); |
288 |
TextNode.Attributes.SetNamedItem(NormalAttr); |
289 |
|
290 |
XmlAttribute ThicknessAttr = Program.xml.CreateAttribute("Thickness"); |
291 |
ThicknessAttr.Value = pText.Thickness.ToString(); |
292 |
TextNode.Attributes.SetNamedItem(ThicknessAttr); |
293 |
|
294 |
dumpEntityData(pText, indent, TextNode); |
295 |
|
296 |
node.AppendChild(TextNode); |
297 |
} |
298 |
|
299 |
return TextNode; |
300 |
} |
301 |
|
302 |
/************************************************************************/ |
303 |
/* Dump Attribute data */ |
304 |
/************************************************************************/ |
305 |
static void dumpAttributeData(int indent, AttributeReference pAttr, int i, XmlNode node) |
306 |
{ |
307 |
writeLine(indent, "Field Length", pAttr.FieldLength); |
308 |
writeLine(indent, "Invisible", pAttr.Invisible); |
309 |
writeLine(indent, "Preset", pAttr.IsPreset); |
310 |
writeLine(indent, "Verifiable", pAttr.IsVerifiable); |
311 |
writeLine(indent, "Locked in Position", pAttr.LockPositionInBlock); |
312 |
writeLine(indent, "Constant", pAttr.IsConstant); |
313 |
|
314 |
XmlNode TextNode = dumpTextData(pAttr, indent, node); |
315 |
if (TextNode != null) |
316 |
{ |
317 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
318 |
HandleAttr.Value = pAttr.Handle.ToString(); |
319 |
TextNode.Attributes.SetNamedItem(HandleAttr); |
320 |
|
321 |
XmlAttribute TagAttr = Program.xml.CreateAttribute("Tag"); |
322 |
TagAttr.Value = pAttr.Tag; |
323 |
TextNode.Attributes.SetNamedItem(TagAttr); |
324 |
} |
325 |
} |
326 |
|
327 |
/************************************************************************/ |
328 |
/* Dump Block Reference Data */ |
329 |
/************************************************************************/ |
330 |
static XmlNode dumpBlockRefData(BlockReference pBlkRef, int indent, XmlNode node) |
331 |
{ |
332 |
if (node != null) |
333 |
{ |
334 |
XmlNode BlockReferenceNode = Program.xml.CreateElement(pBlkRef.GetRXClass().Name); |
335 |
|
336 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
337 |
HandleAttr.Value = pBlkRef.Handle.ToString(); |
338 |
BlockReferenceNode.Attributes.SetNamedItem(HandleAttr); |
339 |
|
340 |
XmlAttribute XAttr = Program.xml.CreateAttribute("X"); |
341 |
XAttr.Value = pBlkRef.Position.X.ToString(); |
342 |
BlockReferenceNode.Attributes.SetNamedItem(XAttr); |
343 |
|
344 |
XmlAttribute YAttr = Program.xml.CreateAttribute("Y"); |
345 |
YAttr.Value = pBlkRef.Position.Y.ToString(); |
346 |
BlockReferenceNode.Attributes.SetNamedItem(YAttr); |
347 |
|
348 |
XmlAttribute ZAttr = Program.xml.CreateAttribute("Z"); |
349 |
ZAttr.Value = pBlkRef.Position.Z.ToString(); |
350 |
BlockReferenceNode.Attributes.SetNamedItem(ZAttr); |
351 |
|
352 |
XmlAttribute AngleAttr = Program.xml.CreateAttribute("Angle"); |
353 |
AngleAttr.Value = pBlkRef.Rotation.ToString(); |
354 |
BlockReferenceNode.Attributes.SetNamedItem(AngleAttr); |
355 |
|
356 |
XmlAttribute ScaleFactorsAttr = Program.xml.CreateAttribute("ScaleFactors"); |
357 |
ScaleFactorsAttr.Value = pBlkRef.ScaleFactors.ToString(); |
358 |
BlockReferenceNode.Attributes.SetNamedItem(ScaleFactorsAttr); |
359 |
|
360 |
XmlAttribute NormalAttr = Program.xml.CreateAttribute("Normal"); |
361 |
NormalAttr.Value = pBlkRef.Normal.ToString(); |
362 |
BlockReferenceNode.Attributes.SetNamedItem(NormalAttr); |
363 |
|
364 |
XmlAttribute NameAttr = Program.xml.CreateAttribute("Name"); |
365 |
NameAttr.Value = pBlkRef.Name; |
366 |
BlockReferenceNode.Attributes.SetNamedItem(NameAttr); |
367 |
|
368 |
Matrix3d blockTransform = pBlkRef.BlockTransform; |
369 |
CoordinateSystem3d cs = blockTransform.CoordinateSystem3d; |
370 |
writeLine(indent + 1, "Origin", cs.Origin); |
371 |
writeLine(indent + 1, "u-Axis", cs.Xaxis); |
372 |
writeLine(indent + 1, "v-Axis", cs.Yaxis); |
373 |
writeLine(indent + 1, "z-Axis", cs.Zaxis); |
374 |
|
375 |
dumpEntityData(pBlkRef, indent, BlockReferenceNode); |
376 |
|
377 |
DBObjectCollection objColl = new DBObjectCollection(); |
378 |
pBlkRef.Explode(objColl); |
379 |
foreach (var obj in objColl) |
380 |
{ |
381 |
if (obj is DBText) |
382 |
{ |
383 |
dumpTextData(obj as DBText, indent, BlockReferenceNode); |
384 |
} |
385 |
} |
386 |
|
387 |
/**********************************************************************/ |
388 |
/* Dump the attributes */ |
389 |
/**********************************************************************/ |
390 |
int i = 0; |
391 |
AttributeCollection attCol = pBlkRef.AttributeCollection; |
392 |
foreach (ObjectId id in attCol) |
393 |
{ |
394 |
try |
395 |
{ |
396 |
using (AttributeReference pAttr = (AttributeReference)id.Open(OpenMode.ForRead)) |
397 |
dumpAttributeData(indent, pAttr, i++, BlockReferenceNode); |
398 |
} |
399 |
catch (System.Exception) |
400 |
{ |
401 |
|
402 |
} |
403 |
} |
404 |
|
405 |
node.AppendChild(BlockReferenceNode); |
406 |
|
407 |
return BlockReferenceNode; |
408 |
} |
409 |
|
410 |
return null; |
411 |
} |
412 |
/************************************************************************/ |
413 |
/* Dump data common to all OdDbCurves */ |
414 |
/************************************************************************/ |
415 |
static void dumpCurveData(Entity pEnt, int indent, XmlNode node) |
416 |
{ |
417 |
if (node != null) |
418 |
{ |
419 |
Curve pEntity = (Curve)pEnt; |
420 |
try |
421 |
{ |
422 |
writeLine(indent, "Start Point", pEntity.StartPoint); |
423 |
writeLine(indent, "End Point", pEntity.EndPoint); |
424 |
} |
425 |
catch (System.Exception) |
426 |
{ |
427 |
} |
428 |
writeLine(indent, "Closed", pEntity.Closed); |
429 |
writeLine(indent, "Periodic", pEntity.IsPeriodic); |
430 |
|
431 |
try |
432 |
{ |
433 |
writeLine(indent, "Area", pEntity.Area); |
434 |
} |
435 |
catch (System.Exception) |
436 |
{ |
437 |
} |
438 |
dumpEntityData(pEntity, indent, node); |
439 |
} |
440 |
} |
441 |
|
442 |
/************************************************************************/ |
443 |
/* Dump Dimension data */ |
444 |
/************************************************************************/ |
445 |
static XmlNode dumpDimData(Dimension pDim, int indent, XmlNode node) |
446 |
{ |
447 |
if (node != null) |
448 |
{ |
449 |
XmlElement DimDataNode = Program.xml.CreateElement("DimData"); |
450 |
|
451 |
XmlAttribute CurrentMeasurementAttr = Program.xml.CreateAttribute("CurrentMeasurement"); |
452 |
CurrentMeasurementAttr.Value = pDim.CurrentMeasurement.ToString(); |
453 |
DimDataNode.Attributes.SetNamedItem(CurrentMeasurementAttr); |
454 |
|
455 |
XmlAttribute DimensionTextAttr = Program.xml.CreateAttribute("DimensionText"); |
456 |
DimensionTextAttr.Value = pDim.DimensionText.ToString(); |
457 |
DimDataNode.Attributes.SetNamedItem(DimensionTextAttr); |
458 |
|
459 |
if (pDim.CurrentMeasurement >= 0.0) |
460 |
{ |
461 |
XmlAttribute FormattedMeasurementAttr = Program.xml.CreateAttribute("FormattedMeasurement"); |
462 |
FormattedMeasurementAttr.Value = pDim.FormatMeasurement(pDim.CurrentMeasurement, pDim.DimensionText); |
463 |
DimDataNode.Attributes.SetNamedItem(FormattedMeasurementAttr); |
464 |
} |
465 |
if (pDim.DimBlockId.IsNull) |
466 |
{ |
467 |
writeLine(indent, "Dimension Block NULL"); |
468 |
} |
469 |
else |
470 |
{ |
471 |
using (BlockTableRecord btr = (BlockTableRecord)pDim.DimBlockId.Open(OpenMode.ForRead)) |
472 |
{ |
473 |
XmlAttribute NameAttr = Program.xml.CreateAttribute("Name"); |
474 |
NameAttr.Value = btr.Name; |
475 |
DimDataNode.Attributes.SetNamedItem(NameAttr); |
476 |
} |
477 |
} |
478 |
|
479 |
XmlAttribute DimBlockPositionAttr = Program.xml.CreateAttribute("DimBlockPosition"); |
480 |
DimBlockPositionAttr.Value = pDim.DimBlockPosition.ToString(); |
481 |
DimDataNode.Attributes.SetNamedItem(DimBlockPositionAttr); |
482 |
|
483 |
XmlAttribute TextPositionAttr = Program.xml.CreateAttribute("TextPosition"); |
484 |
TextPositionAttr.Value = pDim.TextPosition.ToString(); |
485 |
DimDataNode.Attributes.SetNamedItem(TextPositionAttr); |
486 |
|
487 |
XmlAttribute TextRotationAttr = Program.xml.CreateAttribute("TextRotation"); |
488 |
TextRotationAttr.Value = pDim.TextRotation.ToString(); |
489 |
DimDataNode.Attributes.SetNamedItem(TextRotationAttr); |
490 |
|
491 |
XmlAttribute DimensionStyleNameAttr = Program.xml.CreateAttribute("DimensionStyleName"); |
492 |
DimensionStyleNameAttr.Value = pDim.DimensionStyleName.ToString(); |
493 |
DimDataNode.Attributes.SetNamedItem(DimensionStyleNameAttr); |
494 |
|
495 |
XmlAttribute DimtfillclrAttr = Program.xml.CreateAttribute("Dimtfillclr"); |
496 |
DimtfillclrAttr.Value = pDim.Dimtfillclr.ToString(); |
497 |
DimDataNode.Attributes.SetNamedItem(DimtfillclrAttr); |
498 |
|
499 |
XmlAttribute DimtfillAttr = Program.xml.CreateAttribute("Dimtfill"); |
500 |
DimtfillAttr.Value = pDim.Dimtfill.ToString(); |
501 |
DimDataNode.Attributes.SetNamedItem(DimtfillAttr); |
502 |
|
503 |
XmlAttribute Dimltex1Attr = Program.xml.CreateAttribute("Dimltex1"); |
504 |
Dimltex1Attr.Value = pDim.Dimltex1.ToString(); |
505 |
DimDataNode.Attributes.SetNamedItem(Dimltex1Attr); |
506 |
|
507 |
XmlAttribute Dimltex2Attr = Program.xml.CreateAttribute("Dimltex2"); |
508 |
Dimltex2Attr.Value = pDim.Dimltex2.ToString(); |
509 |
DimDataNode.Attributes.SetNamedItem(Dimltex2Attr); |
510 |
|
511 |
XmlAttribute DimltypeAttr = Program.xml.CreateAttribute("Dimltype"); |
512 |
DimltypeAttr.Value = pDim.Dimltype.ToString(); |
513 |
DimDataNode.Attributes.SetNamedItem(DimltypeAttr); |
514 |
|
515 |
XmlAttribute HorizontalRotationAttr = Program.xml.CreateAttribute("HorizontalRotation"); |
516 |
HorizontalRotationAttr.Value = pDim.HorizontalRotation.ToString(); |
517 |
DimDataNode.Attributes.SetNamedItem(HorizontalRotationAttr); |
518 |
|
519 |
XmlAttribute ElevationAttr = Program.xml.CreateAttribute("Elevation"); |
520 |
ElevationAttr.Value = pDim.Elevation.ToString(); |
521 |
DimDataNode.Attributes.SetNamedItem(ElevationAttr); |
522 |
|
523 |
XmlAttribute NormalAttr = Program.xml.CreateAttribute("Normal"); |
524 |
NormalAttr.Value = pDim.Normal.ToString(); |
525 |
DimDataNode.Attributes.SetNamedItem(NormalAttr); |
526 |
|
527 |
dumpEntityData(pDim, indent, node); |
528 |
|
529 |
return DimDataNode; |
530 |
} |
531 |
|
532 |
return null; |
533 |
} |
534 |
|
535 |
/************************************************************************/ |
536 |
/* 2 Line Angular Dimension Dumper */ |
537 |
/************************************************************************/ |
538 |
static XmlNode dump(LineAngularDimension2 pDim, int indent, XmlNode node) |
539 |
{ |
540 |
if (node != null) |
541 |
{ |
542 |
XmlElement DimNode = Program.xml.CreateElement(pDim.GetRXClass().Name); |
543 |
|
544 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
545 |
HandleAttr.Value = pDim.Handle.ToString(); |
546 |
DimNode.Attributes.SetNamedItem(HandleAttr); |
547 |
|
548 |
XmlAttribute ArcPointAttr = Program.xml.CreateAttribute("ArcPoint"); |
549 |
ArcPointAttr.Value = pDim.ArcPoint.ToString(); |
550 |
DimNode.Attributes.SetNamedItem(ArcPointAttr); |
551 |
|
552 |
XmlAttribute XLine1StartAttr = Program.xml.CreateAttribute("XLine1Start"); |
553 |
XLine1StartAttr.Value = pDim.XLine1Start.ToString(); |
554 |
DimNode.Attributes.SetNamedItem(XLine1StartAttr); |
555 |
|
556 |
XmlAttribute XLine1EndAttr = Program.xml.CreateAttribute("XLine1End"); |
557 |
XLine1EndAttr.Value = pDim.XLine1End.ToString(); |
558 |
DimNode.Attributes.SetNamedItem(XLine1EndAttr); |
559 |
|
560 |
XmlAttribute XLine2StartAttr = Program.xml.CreateAttribute("XLine2Start"); |
561 |
XLine2StartAttr.Value = pDim.XLine2Start.ToString(); |
562 |
DimNode.Attributes.SetNamedItem(XLine2StartAttr); |
563 |
|
564 |
XmlAttribute XLine2EndAttr = Program.xml.CreateAttribute("XLine2End"); |
565 |
XLine2EndAttr.Value = pDim.XLine2End.ToString(); |
566 |
DimNode.Attributes.SetNamedItem(XLine2EndAttr); |
567 |
|
568 |
dumpDimData(pDim, indent, DimNode); |
569 |
|
570 |
return DimNode; |
571 |
} |
572 |
|
573 |
return null; |
574 |
} |
575 |
|
576 |
/************************************************************************/ |
577 |
/* Dump 2D Vertex data */ |
578 |
/************************************************************************/ |
579 |
static XmlNode dump2dVertex(int indent, Vertex2d pVertex, int i, XmlNode node) |
580 |
{ |
581 |
if (node != null) |
582 |
{ |
583 |
XmlElement VertexNode = Program.xml.CreateElement(pVertex.GetRXClass().Name); |
584 |
|
585 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
586 |
HandleAttr.Value = pVertex.Handle.ToString(); |
587 |
VertexNode.Attributes.SetNamedItem(HandleAttr); |
588 |
|
589 |
XmlAttribute VertexTypeAttr = Program.xml.CreateAttribute("VertexType"); |
590 |
VertexTypeAttr.Value = pVertex.VertexType.ToString(); |
591 |
VertexNode.Attributes.SetNamedItem(VertexTypeAttr); |
592 |
|
593 |
XmlAttribute PositionAttr = Program.xml.CreateAttribute("Position"); |
594 |
PositionAttr.Value = pVertex.Position.ToString(); |
595 |
VertexNode.Attributes.SetNamedItem(PositionAttr); |
596 |
|
597 |
XmlAttribute StartWidthAttr = Program.xml.CreateAttribute("StartWidth"); |
598 |
StartWidthAttr.Value = pVertex.StartWidth.ToString(); |
599 |
VertexNode.Attributes.SetNamedItem(StartWidthAttr); |
600 |
|
601 |
XmlAttribute EndWidthAttr = Program.xml.CreateAttribute("EndWidth"); |
602 |
EndWidthAttr.Value = pVertex.EndWidth.ToString(); |
603 |
VertexNode.Attributes.SetNamedItem(EndWidthAttr); |
604 |
|
605 |
XmlAttribute BulgeAttr = Program.xml.CreateAttribute("Bulge"); |
606 |
BulgeAttr.Value = pVertex.Bulge.ToString(); |
607 |
VertexNode.Attributes.SetNamedItem(BulgeAttr); |
608 |
|
609 |
if (pVertex.Bulge != 0) |
610 |
{ |
611 |
XmlAttribute BulgeAngleAttr = Program.xml.CreateAttribute("BulgeAngle"); |
612 |
BulgeAngleAttr.Value = (4 * Math.Atan(pVertex.Bulge)).ToString(); |
613 |
VertexNode.Attributes.SetNamedItem(BulgeAngleAttr); |
614 |
} |
615 |
|
616 |
XmlAttribute TangentUsedAttr = Program.xml.CreateAttribute("TangentUsed"); |
617 |
TangentUsedAttr.Value = pVertex.TangentUsed.ToString(); |
618 |
VertexNode.Attributes.SetNamedItem(TangentUsedAttr); |
619 |
if (pVertex.TangentUsed) |
620 |
{ |
621 |
XmlAttribute TangentAttr = Program.xml.CreateAttribute("Tangent"); |
622 |
TangentAttr.Value = pVertex.Tangent.ToString(); |
623 |
VertexNode.Attributes.SetNamedItem(TangentAttr); |
624 |
} |
625 |
|
626 |
node.AppendChild(VertexNode); |
627 |
|
628 |
return VertexNode; |
629 |
} |
630 |
|
631 |
return null; |
632 |
} |
633 |
|
634 |
/************************************************************************/ |
635 |
/* 2D Polyline Dumper */ |
636 |
/************************************************************************/ |
637 |
static XmlNode dump(Polyline2d pPolyline, int indent, XmlNode node) |
638 |
{ |
639 |
/********************************************************************/ |
640 |
/* Dump the vertices */ |
641 |
/********************************************************************/ |
642 |
List<Vertex2d> Vertices = new List<Vertex2d>(); |
643 |
int i = 0; |
644 |
foreach (ObjectId obj in pPolyline) |
645 |
{ |
646 |
using (DBObject dbObj = (DBObject)obj.GetObject(OpenMode.ForRead)) |
647 |
{ |
648 |
if (dbObj is Vertex2d) |
649 |
{ |
650 |
Vertices.Add((Vertex2d)dbObj); |
651 |
/// dump2dVertex(indent, (Vertex2d)dbObj, i++); |
652 |
} |
653 |
} |
654 |
} |
655 |
|
656 |
if (node != null) |
657 |
{ |
658 |
XmlNode Polyline2dNode = Program.xml.CreateElement(pPolyline.GetRXClass().Name); |
659 |
|
660 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
661 |
HandleAttr.Value = pPolyline.Handle.ToString(); |
662 |
Polyline2dNode.Attributes.SetNamedItem(HandleAttr); |
663 |
|
664 |
XmlAttribute CountAttr = Program.xml.CreateAttribute("Count"); |
665 |
CountAttr.Value = Vertices.Count.ToString(); |
666 |
Polyline2dNode.Attributes.SetNamedItem(CountAttr); |
667 |
|
668 |
XmlAttribute ElevationAttr = Program.xml.CreateAttribute("Elevation"); |
669 |
ElevationAttr.Value = pPolyline.Elevation.ToString(); |
670 |
Polyline2dNode.Attributes.SetNamedItem(ElevationAttr); |
671 |
|
672 |
XmlAttribute NormalAttr = Program.xml.CreateAttribute("Normal"); |
673 |
NormalAttr.Value = pPolyline.Normal.ToString(); |
674 |
Polyline2dNode.Attributes.SetNamedItem(NormalAttr); |
675 |
|
676 |
XmlAttribute ThicknessAttr = Program.xml.CreateAttribute("Thickness"); |
677 |
ThicknessAttr.Value = pPolyline.Thickness.ToString(); |
678 |
Polyline2dNode.Attributes.SetNamedItem(ThicknessAttr); |
679 |
|
680 |
XmlAttribute ClosedAttr = Program.xml.CreateAttribute("Closed"); |
681 |
ClosedAttr.Value = pPolyline.Closed.ToString(); |
682 |
Polyline2dNode.Attributes.SetNamedItem(ClosedAttr); |
683 |
|
684 |
foreach (var vt in Vertices) |
685 |
{ |
686 |
XmlNode VertexNode = Program.xml.CreateElement("Vertex"); |
687 |
|
688 |
XmlAttribute XAttr = Program.xml.CreateAttribute("X"); |
689 |
XAttr.Value = vt.Position.X.ToString(); |
690 |
VertexNode.Attributes.SetNamedItem(XAttr); |
691 |
|
692 |
XmlAttribute YAttr = Program.xml.CreateAttribute("Y"); |
693 |
YAttr.Value = vt.Position.Y.ToString(); |
694 |
VertexNode.Attributes.SetNamedItem(YAttr); |
695 |
|
696 |
XmlAttribute ZAttr = Program.xml.CreateAttribute("Z"); |
697 |
ZAttr.Value = vt.Position.Z.ToString(); |
698 |
VertexNode.Attributes.SetNamedItem(ZAttr); |
699 |
|
700 |
Polyline2dNode.AppendChild(VertexNode); |
701 |
} |
702 |
|
703 |
dumpCurveData(pPolyline, indent, node); |
704 |
|
705 |
node.AppendChild(Polyline2dNode); |
706 |
|
707 |
return Polyline2dNode; |
708 |
} |
709 |
|
710 |
return null; |
711 |
} |
712 |
|
713 |
|
714 |
/************************************************************************/ |
715 |
/* Dump 3D Polyline Vertex data */ |
716 |
/************************************************************************/ |
717 |
XmlNode dump3dPolylineVertex(int indent, PolylineVertex3d pVertex, int i, XmlNode node) |
718 |
{ |
719 |
if (node != null) |
720 |
{ |
721 |
XmlNode VertexNode = Program.xml.CreateElement(pVertex.GetRXClass().Name); |
722 |
|
723 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
724 |
HandleAttr.Value = pVertex.Handle.ToString(); |
725 |
VertexNode.Attributes.SetNamedItem(HandleAttr); |
726 |
|
727 |
XmlAttribute VertexxTypeAttr = Program.xml.CreateAttribute("VertexType"); |
728 |
VertexxTypeAttr.Value = pVertex.VertexType.ToString(); |
729 |
VertexNode.Attributes.SetNamedItem(VertexxTypeAttr); |
730 |
|
731 |
XmlAttribute XAttr = Program.xml.CreateAttribute("X"); |
732 |
XAttr.Value = pVertex.Position.X.ToString(); |
733 |
VertexNode.Attributes.SetNamedItem(XAttr); |
734 |
|
735 |
XmlAttribute YAttr = Program.xml.CreateAttribute("Y"); |
736 |
YAttr.Value = pVertex.Position.Y.ToString(); |
737 |
VertexNode.Attributes.SetNamedItem(YAttr); |
738 |
|
739 |
XmlAttribute ZAttr = Program.xml.CreateAttribute("Z"); |
740 |
ZAttr.Value = pVertex.Position.Z.ToString(); |
741 |
VertexNode.Attributes.SetNamedItem(ZAttr); |
742 |
|
743 |
node.AppendChild(VertexNode); |
744 |
|
745 |
return VertexNode; |
746 |
} |
747 |
|
748 |
return null; |
749 |
} |
750 |
|
751 |
/************************************************************************/ |
752 |
/* 3D Polyline Dumper */ |
753 |
/************************************************************************/ |
754 |
XmlNode dump(Polyline3d pPolyline, int indent, XmlNode node) |
755 |
{ |
756 |
if (node != null) |
757 |
{ |
758 |
XmlNode pPolylineNode = Program.xml.CreateElement(pPolyline.GetRXClass().Name); |
759 |
|
760 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
761 |
HandleAttr.Value = pPolyline.Handle.ToString(); |
762 |
pPolylineNode.Attributes.SetNamedItem(HandleAttr); |
763 |
|
764 |
/********************************************************************/ |
765 |
/* Dump the vertices */ |
766 |
/********************************************************************/ |
767 |
int i = 0; |
768 |
foreach (ObjectId obj in pPolyline) |
769 |
{ |
770 |
using (DBObject dbObj = (DBObject)obj.GetObject(OpenMode.ForRead)) |
771 |
{ |
772 |
if (dbObj is PolylineVertex3d) |
773 |
{ |
774 |
dump3dPolylineVertex(indent, (PolylineVertex3d)dbObj, i++, pPolylineNode); |
775 |
} |
776 |
} |
777 |
} |
778 |
dumpCurveData(pPolyline, indent, pPolylineNode); |
779 |
|
780 |
node.AppendChild(pPolylineNode); |
781 |
|
782 |
return pPolylineNode; |
783 |
} |
784 |
|
785 |
return null; |
786 |
} |
787 |
|
788 |
|
789 |
/************************************************************************/ |
790 |
/* 3DSolid Dumper */ |
791 |
/************************************************************************/ |
792 |
XmlNode dump(Solid3d pSolid, int indent, XmlNode node) |
793 |
{ |
794 |
if (node != null) |
795 |
{ |
796 |
XmlNode SolidNode = Program.xml.CreateElement(pSolid.GetRXClass().Name); |
797 |
|
798 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
799 |
HandleAttr.Value = pSolid.Handle.ToString(); |
800 |
SolidNode.Attributes.SetNamedItem(HandleAttr); |
801 |
|
802 |
dumpEntityData(pSolid, indent, node); |
803 |
|
804 |
node.AppendChild(SolidNode); |
805 |
|
806 |
return SolidNode; |
807 |
} |
808 |
|
809 |
return null; |
810 |
} |
811 |
|
812 |
|
813 |
/************************************************************************/ |
814 |
/* 3 Point Angular Dimension Dumper */ |
815 |
/************************************************************************/ |
816 |
XmlNode dump(Point3AngularDimension pDim, int indent, XmlNode node) |
817 |
{ |
818 |
if (node != null) |
819 |
{ |
820 |
XmlElement DimNode = Program.xml.CreateElement(pDim.GetRXClass().Name); |
821 |
|
822 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
823 |
HandleAttr.Value = pDim.Handle.ToString(); |
824 |
DimNode.Attributes.SetNamedItem(HandleAttr); |
825 |
|
826 |
XmlAttribute ArcPointAttr = Program.xml.CreateAttribute("ArcPoint"); |
827 |
ArcPointAttr.Value = pDim.ArcPoint.ToString(); |
828 |
DimNode.Attributes.SetNamedItem(ArcPointAttr); |
829 |
|
830 |
XmlAttribute CenterPointAttr = Program.xml.CreateAttribute("CenterPoint"); |
831 |
CenterPointAttr.Value = pDim.CenterPoint.ToString(); |
832 |
DimNode.Attributes.SetNamedItem(CenterPointAttr); |
833 |
|
834 |
XmlAttribute XLine1PointAttr = Program.xml.CreateAttribute("XLine1Point"); |
835 |
XLine1PointAttr.Value = pDim.XLine1Point.ToString(); |
836 |
DimNode.Attributes.SetNamedItem(XLine1PointAttr); |
837 |
|
838 |
XmlAttribute XLine2PointAttr = Program.xml.CreateAttribute("XLine2Point"); |
839 |
XLine2PointAttr.Value = pDim.XLine2Point.ToString(); |
840 |
DimNode.Attributes.SetNamedItem(XLine2PointAttr); |
841 |
|
842 |
dumpDimData(pDim, indent, DimNode); |
843 |
|
844 |
return DimNode; |
845 |
} |
846 |
|
847 |
return null; |
848 |
} |
849 |
|
850 |
/************************************************************************/ |
851 |
/* Aligned Dimension Dumper */ |
852 |
/************************************************************************/ |
853 |
XmlNode dump(AlignedDimension pDim, int indent, XmlNode node) |
854 |
{ |
855 |
if (node != null) |
856 |
{ |
857 |
XmlElement DimNode = Program.xml.CreateElement(pDim.GetRXClass().Name); |
858 |
|
859 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
860 |
HandleAttr.Value = pDim.Handle.ToString(); |
861 |
DimNode.Attributes.SetNamedItem(HandleAttr); |
862 |
|
863 |
XmlAttribute DimLinePointAttr = Program.xml.CreateAttribute("DimLinePoint"); |
864 |
DimLinePointAttr.Value = pDim.DimLinePoint.ToString(); |
865 |
DimNode.Attributes.SetNamedItem(DimLinePointAttr); |
866 |
|
867 |
XmlAttribute ObliqueAttr = Program.xml.CreateAttribute("Oblique"); |
868 |
ObliqueAttr.Value = pDim.Oblique.ToString(); |
869 |
DimNode.Attributes.SetNamedItem(ObliqueAttr); |
870 |
|
871 |
XmlAttribute XLine1PointAttr = Program.xml.CreateAttribute("XLine1Point"); |
872 |
XLine1PointAttr.Value = pDim.XLine1Point.ToString(); |
873 |
DimNode.Attributes.SetNamedItem(XLine1PointAttr); |
874 |
|
875 |
XmlAttribute XLine2PointAttr = Program.xml.CreateAttribute("XLine2Point"); |
876 |
XLine2PointAttr.Value = pDim.XLine2Point.ToString(); |
877 |
DimNode.Attributes.SetNamedItem(XLine2PointAttr); |
878 |
|
879 |
dumpDimData(pDim, indent, DimNode); |
880 |
|
881 |
return DimNode; |
882 |
} |
883 |
|
884 |
return null; |
885 |
} |
886 |
|
887 |
/************************************************************************/ |
888 |
/* Arc Dumper */ |
889 |
/************************************************************************/ |
890 |
XmlNode dump(Arc pArc, int indent, XmlNode node) |
891 |
{ |
892 |
if (node != null) |
893 |
{ |
894 |
XmlElement ArcNode = Program.xml.CreateElement(pArc.GetRXClass().Name); |
895 |
|
896 |
XmlAttribute XAttr = Program.xml.CreateAttribute("X"); |
897 |
XAttr.Value = pArc.Center.X.ToString(); |
898 |
ArcNode.Attributes.SetNamedItem(XAttr); |
899 |
|
900 |
XmlAttribute YAttr = Program.xml.CreateAttribute("Y"); |
901 |
YAttr.Value = pArc.Center.Y.ToString(); |
902 |
ArcNode.Attributes.SetNamedItem(YAttr); |
903 |
|
904 |
XmlAttribute ZAttr = Program.xml.CreateAttribute("Z"); |
905 |
ZAttr.Value = pArc.Center.Z.ToString(); |
906 |
ArcNode.Attributes.SetNamedItem(ZAttr); |
907 |
|
908 |
XmlAttribute RadiusAttr = Program.xml.CreateAttribute("Radius"); |
909 |
RadiusAttr.Value = pArc.Radius.ToString(); |
910 |
ArcNode.Attributes.SetNamedItem(RadiusAttr); |
911 |
|
912 |
XmlAttribute StartAngleAttr = Program.xml.CreateAttribute("StartAngle"); |
913 |
StartAngleAttr.Value = pArc.StartAngle.ToString(); |
914 |
ArcNode.Attributes.SetNamedItem(StartAngleAttr); |
915 |
|
916 |
XmlAttribute EndAngleAttr = Program.xml.CreateAttribute("EndAngle"); |
917 |
EndAngleAttr.Value = pArc.EndAngle.ToString(); |
918 |
ArcNode.Attributes.SetNamedItem(EndAngleAttr); |
919 |
|
920 |
XmlAttribute NormalAttr = Program.xml.CreateAttribute("Normal"); |
921 |
NormalAttr.Value = pArc.Normal.ToString(); |
922 |
ArcNode.Attributes.SetNamedItem(NormalAttr); |
923 |
|
924 |
XmlAttribute ThicknessAttr = Program.xml.CreateAttribute("Thickness"); |
925 |
ThicknessAttr.Value = pArc.Normal.ToString(); |
926 |
ArcNode.Attributes.SetNamedItem(ThicknessAttr); |
927 |
|
928 |
writeLine(indent++, pArc.GetRXClass().Name, pArc.Handle); |
929 |
dumpCurveData(pArc, indent, ArcNode); |
930 |
|
931 |
node.AppendChild(ArcNode); |
932 |
|
933 |
return ArcNode; |
934 |
} |
935 |
|
936 |
return null; |
937 |
} |
938 |
|
939 |
/************************************************************************/ |
940 |
/* Arc Dimension Dumper */ |
941 |
/************************************************************************/ |
942 |
XmlNode dump(ArcDimension pDim, int indent, XmlNode node) |
943 |
{ |
944 |
if (node != null) |
945 |
{ |
946 |
XmlElement DimNode = Program.xml.CreateElement(pDim.GetRXClass().Name); |
947 |
|
948 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
949 |
HandleAttr.Value = pDim.Handle.ToString(); |
950 |
DimNode.Attributes.SetNamedItem(HandleAttr); |
951 |
|
952 |
XmlAttribute ArcPointAttr = Program.xml.CreateAttribute("ArcPoint"); |
953 |
ArcPointAttr.Value = pDim.ArcPoint.ToString(); |
954 |
DimNode.Attributes.SetNamedItem(ArcPointAttr); |
955 |
|
956 |
XmlAttribute CenterPointAttr = Program.xml.CreateAttribute("CenterPoint"); |
957 |
CenterPointAttr.Value = pDim.CenterPoint.ToString(); |
958 |
DimNode.Attributes.SetNamedItem(CenterPointAttr); |
959 |
|
960 |
XmlAttribute ArcSymbolTypeAttr = Program.xml.CreateAttribute("ArcSymbolType"); |
961 |
ArcSymbolTypeAttr.Value = pDim.ArcSymbolType.ToString(); |
962 |
DimNode.Attributes.SetNamedItem(ArcSymbolTypeAttr); |
963 |
|
964 |
XmlAttribute IsPartialAttr = Program.xml.CreateAttribute("IsPartial"); |
965 |
IsPartialAttr.Value = pDim.IsPartial.ToString(); |
966 |
DimNode.Attributes.SetNamedItem(IsPartialAttr); |
967 |
|
968 |
XmlAttribute HasLeaderAttr = Program.xml.CreateAttribute("HasLeader"); |
969 |
HasLeaderAttr.Value = pDim.HasLeader.ToString(); |
970 |
DimNode.Attributes.SetNamedItem(HasLeaderAttr); |
971 |
|
972 |
if (pDim.HasLeader) |
973 |
{ |
974 |
XmlAttribute Leader1PointAttr = Program.xml.CreateAttribute("Leader1Point"); |
975 |
Leader1PointAttr.Value = pDim.Leader1Point.ToString(); |
976 |
DimNode.Attributes.SetNamedItem(Leader1PointAttr); |
977 |
|
978 |
XmlAttribute Leader2PointAttr = Program.xml.CreateAttribute("Leader2Point"); |
979 |
Leader2PointAttr.Value = pDim.Leader2Point.ToString(); |
980 |
DimNode.Attributes.SetNamedItem(Leader2PointAttr); |
981 |
} |
982 |
|
983 |
XmlAttribute XLine1PointAttr = Program.xml.CreateAttribute("XLine1Point"); |
984 |
XLine1PointAttr.Value = pDim.XLine1Point.ToString(); |
985 |
DimNode.Attributes.SetNamedItem(XLine1PointAttr); |
986 |
|
987 |
XmlAttribute XLine2PointAttr = Program.xml.CreateAttribute("XLine2Point"); |
988 |
XLine2PointAttr.Value = pDim.XLine2Point.ToString(); |
989 |
DimNode.Attributes.SetNamedItem(XLine2PointAttr); |
990 |
|
991 |
dumpDimData(pDim, indent, DimNode); |
992 |
|
993 |
return DimNode; |
994 |
} |
995 |
|
996 |
return null; |
997 |
} |
998 |
|
999 |
|
1000 |
/************************************************************************/ |
1001 |
/* Block Reference Dumper */ |
1002 |
/************************************************************************/ |
1003 |
void dump(BlockReference pBlkRef, int indent, XmlNode node) |
1004 |
{ |
1005 |
using (BlockTableRecord pRecord = (BlockTableRecord)pBlkRef.BlockTableRecord.Open(OpenMode.ForRead)) |
1006 |
{ |
1007 |
XmlNode BlockRefNode = dumpBlockRefData(pBlkRef, indent, node); |
1008 |
if (BlockRefNode != null) |
1009 |
{ |
1010 |
XmlAttribute NameAttr = Program.xml.CreateAttribute("Name"); |
1011 |
NameAttr.Value = pRecord.Name; |
1012 |
BlockRefNode.Attributes.SetNamedItem(NameAttr); |
1013 |
} |
1014 |
} |
1015 |
} |
1016 |
|
1017 |
/************************************************************************/ |
1018 |
/* Body Dumper */ |
1019 |
/************************************************************************/ |
1020 |
XmlNode dump(Body pBody, int indent, XmlNode node) |
1021 |
{ |
1022 |
if (node != null) |
1023 |
{ |
1024 |
XmlNode BodyNode = Program.xml.CreateElement(pBody.GetRXClass().Name); |
1025 |
|
1026 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
1027 |
HandleAttr.Value = pBody.Handle.ToString(); |
1028 |
BodyNode.Attributes.SetNamedItem(HandleAttr); |
1029 |
|
1030 |
dumpEntityData(pBody, indent, BodyNode); |
1031 |
|
1032 |
return BodyNode; |
1033 |
} |
1034 |
|
1035 |
return null; |
1036 |
} |
1037 |
|
1038 |
|
1039 |
/************************************************************************/ |
1040 |
/* Circle Dumper */ |
1041 |
/************************************************************************/ |
1042 |
XmlNode dump(Circle pCircle, int indent, XmlNode node) |
1043 |
{ |
1044 |
if (node != null) |
1045 |
{ |
1046 |
XmlElement CircleNode = Program.xml.CreateElement(pCircle.GetRXClass().Name); |
1047 |
|
1048 |
XmlAttribute XAttr = Program.xml.CreateAttribute("X"); |
1049 |
XAttr.Value = pCircle.Center.X.ToString(); |
1050 |
CircleNode.Attributes.SetNamedItem(XAttr); |
1051 |
|
1052 |
XmlAttribute YAttr = Program.xml.CreateAttribute("Y"); |
1053 |
YAttr.Value = pCircle.Center.Y.ToString(); |
1054 |
CircleNode.Attributes.SetNamedItem(YAttr); |
1055 |
|
1056 |
XmlAttribute RadiusAttr = Program.xml.CreateAttribute("Radius"); |
1057 |
RadiusAttr.Value = pCircle.Radius.ToString(); |
1058 |
CircleNode.Attributes.SetNamedItem(RadiusAttr); |
1059 |
|
1060 |
XmlAttribute NormalAttr = Program.xml.CreateAttribute("Normal"); |
1061 |
NormalAttr.Value = pCircle.Normal.ToString(); |
1062 |
CircleNode.Attributes.SetNamedItem(NormalAttr); |
1063 |
|
1064 |
XmlAttribute ThicknessAttr = Program.xml.CreateAttribute("Thickness"); |
1065 |
ThicknessAttr.Value = pCircle.Thickness.ToString(); |
1066 |
CircleNode.Attributes.SetNamedItem(ThicknessAttr); |
1067 |
|
1068 |
dumpCurveData(pCircle, indent, CircleNode); |
1069 |
|
1070 |
node.AppendChild(CircleNode); |
1071 |
|
1072 |
return CircleNode; |
1073 |
} |
1074 |
|
1075 |
return null; |
1076 |
} |
1077 |
|
1078 |
/************************************************************************/ |
1079 |
/* Diametric Dimension Dumper */ |
1080 |
/************************************************************************/ |
1081 |
XmlNode dump(DiametricDimension pDim, int indent, XmlNode node) |
1082 |
{ |
1083 |
if (node != null) |
1084 |
{ |
1085 |
XmlElement DimNode = Program.xml.CreateElement(pDim.GetRXClass().Name); |
1086 |
|
1087 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
1088 |
HandleAttr.Value = pDim.Handle.ToString(); |
1089 |
DimNode.Attributes.SetNamedItem(HandleAttr); |
1090 |
|
1091 |
XmlAttribute ChordPointAttr = Program.xml.CreateAttribute("ChordPoint"); |
1092 |
ChordPointAttr.Value = pDim.ChordPoint.ToString(); |
1093 |
DimNode.Attributes.SetNamedItem(ChordPointAttr); |
1094 |
|
1095 |
XmlAttribute FarChordPointAttr = Program.xml.CreateAttribute("FarChordPoint"); |
1096 |
FarChordPointAttr.Value = pDim.FarChordPoint.ToString(); |
1097 |
DimNode.Attributes.SetNamedItem(FarChordPointAttr); |
1098 |
|
1099 |
XmlAttribute LeaderLengthAttr = Program.xml.CreateAttribute("LeaderLength"); |
1100 |
LeaderLengthAttr.Value = pDim.LeaderLength.ToString(); |
1101 |
DimNode.Attributes.SetNamedItem(LeaderLengthAttr); |
1102 |
|
1103 |
dumpDimData(pDim, indent, DimNode); |
1104 |
|
1105 |
return DimNode; |
1106 |
} |
1107 |
|
1108 |
return null; |
1109 |
} |
1110 |
|
1111 |
/************************************************************************/ |
1112 |
/* Ellipse Dumper */ |
1113 |
/************************************************************************/ |
1114 |
void dump(Ellipse pEllipse, int indent, XmlNode node) |
1115 |
{ |
1116 |
if (node != null) |
1117 |
{ |
1118 |
XmlElement EllipseNode = Program.xml.CreateElement(pEllipse.GetRXClass().Name); |
1119 |
|
1120 |
writeLine(indent++, pEllipse.GetRXClass().Name, pEllipse.Handle); |
1121 |
|
1122 |
XmlAttribute XAttr = Program.xml.CreateAttribute("X"); |
1123 |
XAttr.Value = pEllipse.Center.X.ToString(); |
1124 |
EllipseNode.Attributes.SetNamedItem(XAttr); |
1125 |
|
1126 |
XmlAttribute YAttr = Program.xml.CreateAttribute("Y"); |
1127 |
YAttr.Value = pEllipse.Center.Y.ToString(); |
1128 |
EllipseNode.Attributes.SetNamedItem(YAttr); |
1129 |
|
1130 |
XmlAttribute MajorAxisAttr = Program.xml.CreateAttribute("MajorAxis"); |
1131 |
MajorAxisAttr.Value = pEllipse.MajorAxis.ToString(); |
1132 |
EllipseNode.Attributes.SetNamedItem(MajorAxisAttr); |
1133 |
|
1134 |
XmlAttribute MinorAxisAttr = Program.xml.CreateAttribute("MinorAxis"); |
1135 |
MinorAxisAttr.Value = pEllipse.MinorAxis.ToString(); |
1136 |
EllipseNode.Attributes.SetNamedItem(MinorAxisAttr); |
1137 |
|
1138 |
XmlAttribute MajorRadiusAttr = Program.xml.CreateAttribute("MajorRadius"); |
1139 |
MajorRadiusAttr.Value = pEllipse.MajorRadius.ToString(); |
1140 |
EllipseNode.Attributes.SetNamedItem(MajorRadiusAttr); |
1141 |
|
1142 |
XmlAttribute MinorRadiusAttr = Program.xml.CreateAttribute("MinorRadius"); |
1143 |
MinorRadiusAttr.Value = pEllipse.MinorRadius.ToString(); |
1144 |
EllipseNode.Attributes.SetNamedItem(MinorRadiusAttr); |
1145 |
|
1146 |
XmlAttribute RadiusRatioAttr = Program.xml.CreateAttribute("RadiusRatio"); |
1147 |
RadiusRatioAttr.Value = pEllipse.RadiusRatio.ToString(); |
1148 |
EllipseNode.Attributes.SetNamedItem(RadiusRatioAttr); |
1149 |
|
1150 |
XmlAttribute StartAngleAttr = Program.xml.CreateAttribute("StartAngle"); |
1151 |
StartAngleAttr.Value = pEllipse.StartAngle.ToString(); |
1152 |
EllipseNode.Attributes.SetNamedItem(StartAngleAttr); |
1153 |
|
1154 |
XmlAttribute EndAngleAttr = Program.xml.CreateAttribute("EndAngle"); |
1155 |
EndAngleAttr.Value = pEllipse.EndAngle.ToString(); |
1156 |
EllipseNode.Attributes.SetNamedItem(EndAngleAttr); |
1157 |
|
1158 |
XmlAttribute NormalAttr = Program.xml.CreateAttribute("Normal"); |
1159 |
NormalAttr.Value = pEllipse.Normal.ToString(); |
1160 |
EllipseNode.Attributes.SetNamedItem(NormalAttr); |
1161 |
|
1162 |
dumpCurveData(pEllipse, indent, EllipseNode); |
1163 |
|
1164 |
node.AppendChild(EllipseNode); |
1165 |
} |
1166 |
} |
1167 |
|
1168 |
/************************************************************************/ |
1169 |
/* Face Dumper */ |
1170 |
/************************************************************************/ |
1171 |
XmlNode dump(Face pFace, int indent, XmlNode node) |
1172 |
{ |
1173 |
if (node != null) |
1174 |
{ |
1175 |
XmlElement FaceNode = Program.xml.CreateElement(pFace.GetRXClass().Name); |
1176 |
|
1177 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
1178 |
HandleAttr.Value = pFace.Handle.ToString(); |
1179 |
FaceNode.Attributes.SetNamedItem(HandleAttr); |
1180 |
|
1181 |
for (short i = 0; i < 4; i++) |
1182 |
{ |
1183 |
XmlElement VertexNode = Program.xml.CreateElement("Vertex"); |
1184 |
|
1185 |
Point3d pt = pFace.GetVertexAt(i); |
1186 |
XmlAttribute XAttr = Program.xml.CreateAttribute("X"); |
1187 |
XAttr.Value = pt.X.ToString(); |
1188 |
VertexNode.Attributes.SetNamedItem(XAttr); |
1189 |
|
1190 |
XmlAttribute YAttr = Program.xml.CreateAttribute("Y"); |
1191 |
YAttr.Value = pt.Y.ToString(); |
1192 |
VertexNode.Attributes.SetNamedItem(YAttr); |
1193 |
|
1194 |
XmlAttribute ZAttr = Program.xml.CreateAttribute("Z"); |
1195 |
ZAttr.Value = pt.Z.ToString(); |
1196 |
VertexNode.Attributes.SetNamedItem(ZAttr); |
1197 |
|
1198 |
XmlAttribute VisibleAttr = Program.xml.CreateAttribute("Visible"); |
1199 |
VisibleAttr.Value = pFace.IsEdgeVisibleAt(i).ToString(); |
1200 |
VertexNode.Attributes.SetNamedItem(VisibleAttr); |
1201 |
|
1202 |
FaceNode.AppendChild(VertexNode); |
1203 |
} |
1204 |
dumpEntityData(pFace, indent, FaceNode); |
1205 |
|
1206 |
node.AppendChild(FaceNode); |
1207 |
|
1208 |
return FaceNode; |
1209 |
} |
1210 |
|
1211 |
return null; |
1212 |
} |
1213 |
|
1214 |
/************************************************************************/ |
1215 |
/* FCF Dumper */ |
1216 |
/************************************************************************/ |
1217 |
void dump(FeatureControlFrame pFcf, int indent) |
1218 |
{ |
1219 |
writeLine(indent++, pFcf.GetRXClass().Name, pFcf.Handle); |
1220 |
writeLine(indent, "Location", pFcf.Location); |
1221 |
writeLine(indent, "Text", pFcf.Text); |
1222 |
writeLine(indent, "Dimension Style", pFcf.DimensionStyleName); |
1223 |
writeLine(indent, "Dimension Gap", pFcf.Dimgap); |
1224 |
writeLine(indent, "Dimension Scale", pFcf.Dimscale); |
1225 |
writeLine(indent, "Text Height", pFcf.Dimtxt); |
1226 |
writeLine(indent, "Frame Color", pFcf.Dimclrd); |
1227 |
writeLine(indent, "Text Style", pFcf.TextStyleName); |
1228 |
writeLine(indent, "Text Color", pFcf.Dimclrd); |
1229 |
writeLine(indent, "X-Direction", pFcf.Direction); |
1230 |
writeLine(indent, "Normal", pFcf.Normal); |
1231 |
dumpEntityData(pFcf, indent, Program.xml.DocumentElement); |
1232 |
} |
1233 |
|
1234 |
/************************************************************************/ |
1235 |
/* Hatch Dumper */ |
1236 |
/************************************************************************/ |
1237 |
/***********************************************************************/ |
1238 |
/* Dump Polyline Loop */ |
1239 |
/***********************************************************************/ |
1240 |
static void dumpPolylineType(int loopIndex, Hatch pHatch, int indent) |
1241 |
{ |
1242 |
HatchLoop hl = pHatch.GetLoopAt(loopIndex); |
1243 |
for (int i = 0; i < hl.Polyline.Count; i++) |
1244 |
{ |
1245 |
BulgeVertex bv = hl.Polyline[i]; |
1246 |
writeLine(indent, "Vertex " + i.ToString(), bv.Vertex.ToString()); |
1247 |
writeLine(indent + 1, "Bulge " + i.ToString(), bv.Bulge); |
1248 |
writeLine(indent + 1, "Bulge angle " + i.ToString(), toDegreeString(4 * Math.Atan(bv.Bulge))); |
1249 |
} |
1250 |
} |
1251 |
|
1252 |
/**********************************************************************/ |
1253 |
/* Dump Circular Arc Edge */ |
1254 |
/**********************************************************************/ |
1255 |
static void dumpCircularArcEdge(int indent, CircularArc2d pCircArc) |
1256 |
{ |
1257 |
writeLine(indent, "Center", pCircArc.Center); |
1258 |
writeLine(indent, "Radius", pCircArc.Radius); |
1259 |
writeLine(indent, "Start Angle", toDegreeString(pCircArc.StartAngle)); |
1260 |
writeLine(indent, "End Angle", toDegreeString(pCircArc.EndAngle)); |
1261 |
writeLine(indent, "Clockwise", pCircArc.IsClockWise); |
1262 |
} |
1263 |
|
1264 |
/**********************************************************************/ |
1265 |
/* Dump Elliptical Arc Edge */ |
1266 |
/**********************************************************************/ |
1267 |
static void dumpEllipticalArcEdge(int indent, EllipticalArc2d pEllipArc) |
1268 |
{ |
1269 |
writeLine(indent, "Center", pEllipArc.Center); |
1270 |
writeLine(indent, "Major Radius", pEllipArc.MajorRadius); |
1271 |
writeLine(indent, "Minor Radius", pEllipArc.MinorRadius); |
1272 |
writeLine(indent, "Major Axis", pEllipArc.MajorAxis); |
1273 |
writeLine(indent, "Minor Axis", pEllipArc.MinorAxis); |
1274 |
writeLine(indent, "Start Angle", toDegreeString(pEllipArc.StartAngle)); |
1275 |
writeLine(indent, "End Angle", toDegreeString(pEllipArc.EndAngle)); |
1276 |
writeLine(indent, "Clockwise", pEllipArc.IsClockWise); |
1277 |
} |
1278 |
|
1279 |
/**********************************************************************/ |
1280 |
/* Dump NurbCurve Edge */ |
1281 |
/**********************************************************************/ |
1282 |
static void dumpNurbCurveEdge(int indent, NurbCurve2d pNurbCurve) |
1283 |
{ |
1284 |
NurbCurve2dData d = pNurbCurve.DefinitionData; |
1285 |
writeLine(indent, "Degree", d.Degree); |
1286 |
writeLine(indent, "Rational", d.Rational); |
1287 |
writeLine(indent, "Periodic", d.Periodic); |
1288 |
|
1289 |
writeLine(indent, "Number of Control Points", d.ControlPoints.Count); |
1290 |
for (int i = 0; i < d.ControlPoints.Count; i++) |
1291 |
{ |
1292 |
writeLine(indent, "Control Point " + i.ToString(), d.ControlPoints[i]); |
1293 |
} |
1294 |
writeLine(indent, "Number of Knots", d.Knots.Count); |
1295 |
for (int i = 0; i < d.Knots.Count; i++) |
1296 |
{ |
1297 |
writeLine(indent, "Knot " + i.ToString(), d.Knots[i]); |
1298 |
} |
1299 |
|
1300 |
if (d.Rational) |
1301 |
{ |
1302 |
writeLine(indent, "Number of Weights", d.Weights.Count); |
1303 |
for (int i = 0; i < d.Weights.Count; i++) |
1304 |
{ |
1305 |
writeLine(indent, "Weight " + i.ToString(), d.Weights[i]); |
1306 |
} |
1307 |
} |
1308 |
} |
1309 |
|
1310 |
/***********************************************************************/ |
1311 |
/* Dump Edge Loop */ |
1312 |
/***********************************************************************/ |
1313 |
static void dumpEdgesType(int loopIndex, Hatch pHatch, int indent) |
1314 |
{ |
1315 |
Curve2dCollection edges = pHatch.GetLoopAt(loopIndex).Curves; |
1316 |
for (int i = 0; i < (int)edges.Count; i++) |
1317 |
{ |
1318 |
using (Curve2d pEdge = edges[i]) |
1319 |
{ |
1320 |
writeLine(indent, string.Format("Edge {0}", i), pEdge.GetType().Name); |
1321 |
switch (pEdge.GetType().Name) |
1322 |
{ |
1323 |
case "LineSegment2d": |
1324 |
break; |
1325 |
case "CircularArc2d": |
1326 |
dumpCircularArcEdge(indent + 1, (CircularArc2d)pEdge); |
1327 |
break; |
1328 |
case "EllipticalArc2d": |
1329 |
dumpEllipticalArcEdge(indent + 1, (EllipticalArc2d)pEdge); |
1330 |
break; |
1331 |
case "NurbCurve2d": |
1332 |
dumpNurbCurveEdge(indent + 1, (NurbCurve2d)pEdge); |
1333 |
break; |
1334 |
} |
1335 |
|
1336 |
/******************************************************************/ |
1337 |
/* Common Edge Properties */ |
1338 |
/******************************************************************/ |
1339 |
Interval interval = pEdge.GetInterval(); |
1340 |
writeLine(indent + 1, "Start Point", pEdge.EvaluatePoint(interval.LowerBound)); |
1341 |
writeLine(indent + 1, "End Point", pEdge.EvaluatePoint(interval.UpperBound)); |
1342 |
writeLine(indent + 1, "Closed", pEdge.IsClosed()); |
1343 |
} |
1344 |
} |
1345 |
} |
1346 |
|
1347 |
/************************************************************************/ |
1348 |
/* Convert the specified value to a LoopType string */ |
1349 |
/************************************************************************/ |
1350 |
string toLooptypeString(HatchLoopTypes loopType) |
1351 |
{ |
1352 |
string retVal = ""; |
1353 |
if ((loopType & HatchLoopTypes.External) != 0) |
1354 |
retVal = retVal + " | kExternal"; |
1355 |
|
1356 |
if ((loopType & HatchLoopTypes.Polyline) != 0) |
1357 |
retVal = retVal + " | kPolyline"; |
1358 |
|
1359 |
if ((loopType & HatchLoopTypes.Derived) != 0) |
1360 |
retVal = retVal + " | kDerived"; |
1361 |
|
1362 |
if ((loopType & HatchLoopTypes.Textbox) != 0) |
1363 |
retVal = retVal + " | kTextbox"; |
1364 |
|
1365 |
if ((loopType & HatchLoopTypes.Outermost) != 0) |
1366 |
retVal = retVal + " | kOutermost"; |
1367 |
|
1368 |
if ((loopType & HatchLoopTypes.NotClosed) != 0) |
1369 |
retVal = retVal + " | kNotClosed"; |
1370 |
|
1371 |
if ((loopType & HatchLoopTypes.SelfIntersecting) != 0) |
1372 |
retVal = retVal + " | kSelfIntersecting"; |
1373 |
|
1374 |
if ((loopType & HatchLoopTypes.TextIsland) != 0) |
1375 |
retVal = retVal + " | kTextIsland"; |
1376 |
|
1377 |
if ((loopType & HatchLoopTypes.Duplicate) != 0) |
1378 |
retVal = retVal + " | kDuplicate"; |
1379 |
|
1380 |
return retVal == "" ? "kDefault" : retVal.Substring(3); |
1381 |
} |
1382 |
|
1383 |
void dump(Hatch pHatch, int indent) |
1384 |
{ |
1385 |
writeLine(indent++, pHatch.GetRXClass().Name, pHatch.Handle); |
1386 |
writeLine(indent, "Hatch Style", pHatch.HatchStyle); |
1387 |
writeLine(indent, "Hatch Object Type", pHatch.HatchObjectType); |
1388 |
writeLine(indent, "Is Hatch", pHatch.IsHatch); |
1389 |
writeLine(indent, "Is Gradient", !pHatch.IsGradient); |
1390 |
if (pHatch.IsHatch) |
1391 |
{ |
1392 |
/******************************************************************/ |
1393 |
/* Dump Hatch Parameters */ |
1394 |
/******************************************************************/ |
1395 |
writeLine(indent, "Pattern Type", pHatch.PatternType); |
1396 |
switch (pHatch.PatternType) |
1397 |
{ |
1398 |
case HatchPatternType.PreDefined: |
1399 |
case HatchPatternType.CustomDefined: |
1400 |
writeLine(indent, "Pattern Name", pHatch.PatternName); |
1401 |
writeLine(indent, "Solid Fill", pHatch.IsSolidFill); |
1402 |
if (!pHatch.IsSolidFill) |
1403 |
{ |
1404 |
writeLine(indent, "Pattern Angle", toDegreeString(pHatch.PatternAngle)); |
1405 |
writeLine(indent, "Pattern Scale", pHatch.PatternScale); |
1406 |
} |
1407 |
break; |
1408 |
case HatchPatternType.UserDefined: |
1409 |
writeLine(indent, "Pattern Angle", toDegreeString(pHatch.PatternAngle)); |
1410 |
writeLine(indent, "Pattern Double", pHatch.PatternDouble); |
1411 |
writeLine(indent, "Pattern Space", pHatch.PatternSpace); |
1412 |
break; |
1413 |
} |
1414 |
DBObjectCollection entitySet = new DBObjectCollection(); |
1415 |
Handle hhh = pHatch.Handle; |
1416 |
if (hhh.Value == 1692) //69C) |
1417 |
{ |
1418 |
pHatch.Explode(entitySet); |
1419 |
return; |
1420 |
} |
1421 |
if (hhh.Value == 1693) //69D) |
1422 |
{ |
1423 |
try |
1424 |
{ |
1425 |
pHatch.Explode(entitySet); |
1426 |
} |
1427 |
catch (System.Exception e) |
1428 |
{ |
1429 |
if (e.Message == "eCannotExplodeEntity") |
1430 |
{ |
1431 |
writeLine(indent, "Hatch " + e.Message + ": ", pHatch.Handle); |
1432 |
return; |
1433 |
} |
1434 |
} |
1435 |
} |
1436 |
} |
1437 |
if (pHatch.IsGradient) |
1438 |
{ |
1439 |
/******************************************************************/ |
1440 |
/* Dump Gradient Parameters */ |
1441 |
/******************************************************************/ |
1442 |
writeLine(indent, "Gradient Type", pHatch.GradientType); |
1443 |
writeLine(indent, "Gradient Name", pHatch.GradientName); |
1444 |
writeLine(indent, "Gradient Angle", toDegreeString(pHatch.GradientAngle)); |
1445 |
writeLine(indent, "Gradient Shift", pHatch.GradientShift); |
1446 |
writeLine(indent, "Gradient One-Color Mode", pHatch.GradientOneColorMode); |
1447 |
if (pHatch.GradientOneColorMode) |
1448 |
{ |
1449 |
writeLine(indent, "ShadeTintValue", pHatch.ShadeTintValue); |
1450 |
} |
1451 |
GradientColor[] colors = pHatch.GetGradientColors(); |
1452 |
for (int i = 0; i < colors.Length; i++) |
1453 |
{ |
1454 |
writeLine(indent, string.Format("Color {0}", i), colors[i].get_Color()); |
1455 |
writeLine(indent, string.Format("Interpolation {0}", i), colors[i].get_Value()); |
1456 |
} |
1457 |
} |
1458 |
|
1459 |
/********************************************************************/ |
1460 |
/* Dump Associated Objects */ |
1461 |
/********************************************************************/ |
1462 |
writeLine(indent, "Associated objects", pHatch.Associative); |
1463 |
foreach (ObjectId id in pHatch.GetAssociatedObjectIds()) |
1464 |
{ |
1465 |
writeLine(indent + 1, id.ObjectClass.Name, id.Handle); |
1466 |
} |
1467 |
|
1468 |
/********************************************************************/ |
1469 |
/* Dump Loops */ |
1470 |
/********************************************************************/ |
1471 |
writeLine(indent, "Loops", pHatch.NumberOfLoops); |
1472 |
for (int i = 0; i < pHatch.NumberOfLoops; i++) |
1473 |
{ |
1474 |
writeLine(indent + 1, "Loop " + i.ToString(), toLooptypeString(pHatch.LoopTypeAt(i))); |
1475 |
|
1476 |
/******************************************************************/ |
1477 |
/* Dump Loop */ |
1478 |
/******************************************************************/ |
1479 |
if ((pHatch.LoopTypeAt(i) & HatchLoopTypes.Polyline) != 0) |
1480 |
{ |
1481 |
dumpPolylineType(i, pHatch, indent + 2); |
1482 |
} |
1483 |
else |
1484 |
{ |
1485 |
dumpEdgesType(i, pHatch, indent + 2); |
1486 |
} |
1487 |
/******************************************************************/ |
1488 |
/* Dump Associated Objects */ |
1489 |
/******************************************************************/ |
1490 |
if (pHatch.Associative) |
1491 |
{ |
1492 |
writeLine(indent + 2, "Associated objects"); |
1493 |
foreach (ObjectId id in pHatch.GetAssociatedObjectIdsAt(i)) |
1494 |
{ |
1495 |
writeLine(indent + 3, id.ObjectClass.Name, id.Handle); |
1496 |
} |
1497 |
} |
1498 |
} |
1499 |
|
1500 |
writeLine(indent, "Elevation", pHatch.Elevation); |
1501 |
writeLine(indent, "Normal", pHatch.Normal); |
1502 |
dumpEntityData(pHatch, indent, Program.xml.DocumentElement); |
1503 |
} |
1504 |
|
1505 |
/************************************************************************/ |
1506 |
/* Leader Dumper */ |
1507 |
/************************************************************************/ |
1508 |
void dump(Leader pLeader, int indent) |
1509 |
{ |
1510 |
writeLine(indent++, pLeader.GetRXClass().Name, pLeader.Handle); |
1511 |
writeLine(indent, "Dimension Style", pLeader.DimensionStyleName); |
1512 |
|
1513 |
writeLine(indent, "Annotation"); |
1514 |
if (!pLeader.Annotation.IsNull) |
1515 |
{ |
1516 |
writeLine(indent++, pLeader.Annotation.ObjectClass.Name, pLeader.Annotation.Handle); |
1517 |
} |
1518 |
writeLine(indent + 1, "Type", pLeader.AnnoType); |
1519 |
writeLine(indent + 1, "Height", pLeader.AnnoHeight); |
1520 |
writeLine(indent + 1, "Width", pLeader.AnnoWidth); |
1521 |
writeLine(indent + 1, "Offset", pLeader.AnnotationOffset); |
1522 |
writeLine(indent, "Has Arrowhead", pLeader.HasArrowHead); |
1523 |
writeLine(indent, "Has Hook Line", pLeader.HasHookLine); |
1524 |
writeLine(indent, "Splined", pLeader.IsSplined); |
1525 |
|
1526 |
for (int i = 0; i < pLeader.NumVertices; i++) |
1527 |
{ |
1528 |
writeLine(indent, string.Format("Vertex {0}", i), pLeader.VertexAt(i)); |
1529 |
} |
1530 |
writeLine(indent, "Normal", pLeader.Normal); |
1531 |
dumpCurveData(pLeader, indent, Program.xml.DocumentElement); |
1532 |
} |
1533 |
|
1534 |
/************************************************************************/ |
1535 |
/* Line Dumper */ |
1536 |
/************************************************************************/ |
1537 |
void dump(Line pLine, int indent, XmlNode node) |
1538 |
{ |
1539 |
if (node != null && pLine != null && pLine.Length != 0) |
1540 |
{ |
1541 |
XmlNode LineNode = Program.xml.CreateElement(pLine.GetRXClass().Name); |
1542 |
XmlAttribute LengthAttr = Program.xml.CreateAttribute("Length"); |
1543 |
LengthAttr.Value = pLine.Length.ToString(); |
1544 |
LineNode.Attributes.SetNamedItem(LengthAttr); |
1545 |
|
1546 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
1547 |
HandleAttr.Value = pLine.Handle.ToString(); |
1548 |
LineNode.Attributes.SetNamedItem(HandleAttr); |
1549 |
|
1550 |
XmlNode StartPointNode = Program.xml.CreateElement("Vertex"); |
1551 |
{ |
1552 |
XmlAttribute XAttr = Program.xml.CreateAttribute("X"); |
1553 |
XAttr.Value = pLine.StartPoint.X.ToString(); |
1554 |
StartPointNode.Attributes.SetNamedItem(XAttr); |
1555 |
|
1556 |
XmlAttribute YAttr = Program.xml.CreateAttribute("Y"); |
1557 |
YAttr.Value = pLine.StartPoint.Y.ToString(); |
1558 |
StartPointNode.Attributes.SetNamedItem(YAttr); |
1559 |
|
1560 |
XmlAttribute ZAttr = Program.xml.CreateAttribute("Z"); |
1561 |
ZAttr.Value = pLine.StartPoint.Z.ToString(); |
1562 |
StartPointNode.Attributes.SetNamedItem(ZAttr); |
1563 |
} |
1564 |
LineNode.AppendChild(StartPointNode); |
1565 |
|
1566 |
XmlNode EndPointNode = Program.xml.CreateElement("Vertex"); |
1567 |
{ |
1568 |
XmlAttribute XAttr = Program.xml.CreateAttribute("X"); |
1569 |
XAttr.Value = pLine.EndPoint.X.ToString(); |
1570 |
EndPointNode.Attributes.SetNamedItem(XAttr); |
1571 |
|
1572 |
XmlAttribute YAttr = Program.xml.CreateAttribute("Y"); |
1573 |
YAttr.Value = pLine.EndPoint.Y.ToString(); |
1574 |
EndPointNode.Attributes.SetNamedItem(YAttr); |
1575 |
|
1576 |
XmlAttribute ZAttr = Program.xml.CreateAttribute("Z"); |
1577 |
ZAttr.Value = pLine.EndPoint.Z.ToString(); |
1578 |
EndPointNode.Attributes.SetNamedItem(ZAttr); |
1579 |
} |
1580 |
LineNode.AppendChild(EndPointNode); |
1581 |
|
1582 |
XmlAttribute NormalAttr = Program.xml.CreateAttribute("Normal"); |
1583 |
NormalAttr.Value = pLine.Normal.ToString(); |
1584 |
LineNode.Attributes.SetNamedItem(NormalAttr); |
1585 |
|
1586 |
XmlAttribute ThicknessAttr = Program.xml.CreateAttribute("Thickness"); |
1587 |
ThicknessAttr.Value = pLine.Thickness.ToString(); |
1588 |
LineNode.Attributes.SetNamedItem(ThicknessAttr); |
1589 |
|
1590 |
dumpEntityData(pLine, indent, LineNode); |
1591 |
|
1592 |
node.AppendChild(LineNode); |
1593 |
} |
1594 |
else |
1595 |
{ |
1596 |
int d = 0; |
1597 |
} |
1598 |
} |
1599 |
|
1600 |
/************************************************************************/ |
1601 |
/* MInsertBlock Dumper */ |
1602 |
/************************************************************************/ |
1603 |
void dump(MInsertBlock pMInsert, int indent, XmlNode node) |
1604 |
{ |
1605 |
writeLine(indent++, pMInsert.GetRXClass().Name, pMInsert.Handle); |
1606 |
|
1607 |
using (BlockTableRecord pRecord = (BlockTableRecord)pMInsert.BlockTableRecord.Open(OpenMode.ForRead)) |
1608 |
{ |
1609 |
writeLine(indent, "Name", pRecord.Name); |
1610 |
writeLine(indent, "Rows", pMInsert.Rows); |
1611 |
writeLine(indent, "Columns", pMInsert.Columns); |
1612 |
writeLine(indent, "Row Spacing", pMInsert.RowSpacing); |
1613 |
writeLine(indent, "Column Spacing", pMInsert.ColumnSpacing); |
1614 |
dumpBlockRefData(pMInsert, indent, node); |
1615 |
} |
1616 |
} |
1617 |
|
1618 |
/************************************************************************/ |
1619 |
/* Mline Dumper */ |
1620 |
/************************************************************************/ |
1621 |
void dump(Mline pMline, int indent) |
1622 |
{ |
1623 |
writeLine(indent++, pMline.GetRXClass().Name, pMline.Handle); |
1624 |
writeLine(indent, "Style", pMline.Style); |
1625 |
writeLine(indent, "Closed", pMline.IsClosed); |
1626 |
writeLine(indent, "Scale", pMline.Scale); |
1627 |
writeLine(indent, "Suppress Start Caps", pMline.SupressStartCaps); |
1628 |
writeLine(indent, "Suppress End Caps", pMline.SupressEndCaps); |
1629 |
writeLine(indent, "Normal", pMline.Normal); |
1630 |
|
1631 |
/********************************************************************/ |
1632 |
/* Dump the segment data */ |
1633 |
/********************************************************************/ |
1634 |
for (int i = 0; i < pMline.NumberOfVertices; i++) |
1635 |
{ |
1636 |
writeLine(indent, "Segment", i); |
1637 |
writeLine(indent + 1, "Vertex", pMline.VertexAt(i)); |
1638 |
} |
1639 |
dumpEntityData(pMline, indent, Program.xml.DocumentElement); |
1640 |
} |
1641 |
|
1642 |
/************************************************************************/ |
1643 |
/* MText Dumper */ |
1644 |
/************************************************************************/ |
1645 |
/// <summary> |
1646 |
/// convert MText to normal Text |
1647 |
/// </summary> |
1648 |
/// <param name="pMText"></param> |
1649 |
/// <param name="indent"></param> |
1650 |
/// <param name="node"></param> |
1651 |
void dump(MText pMText, int indent, XmlNode node) |
1652 |
{ |
1653 |
DBObjectCollection objColl = new DBObjectCollection(); |
1654 |
pMText.Explode(objColl); |
1655 |
foreach(var obj in objColl) |
1656 |
{ |
1657 |
dumpTextData(obj as DBText, indent, node); |
1658 |
} |
1659 |
} |
1660 |
|
1661 |
/************************************************************************/ |
1662 |
/* Ordinate Dimension Dumper */ |
1663 |
/************************************************************************/ |
1664 |
XmlNode dump(OrdinateDimension pDim, int indent, XmlNode node) |
1665 |
{ |
1666 |
if (node != null) |
1667 |
{ |
1668 |
XmlElement DimNode = Program.xml.CreateElement(pDim.GetRXClass().Name); |
1669 |
|
1670 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
1671 |
HandleAttr.Value = pDim.Handle.ToString(); |
1672 |
DimNode.Attributes.SetNamedItem(HandleAttr); |
1673 |
|
1674 |
XmlAttribute DefiningPointAttr = Program.xml.CreateAttribute("DefiningPoint"); |
1675 |
DefiningPointAttr.Value = pDim.DefiningPoint.ToString(); |
1676 |
DimNode.Attributes.SetNamedItem(DefiningPointAttr); |
1677 |
|
1678 |
XmlAttribute UsingXAxisAttr = Program.xml.CreateAttribute("UsingXAxis"); |
1679 |
UsingXAxisAttr.Value = pDim.UsingXAxis.ToString(); |
1680 |
DimNode.Attributes.SetNamedItem(UsingXAxisAttr); |
1681 |
|
1682 |
XmlAttribute UsingYAxisAttr = Program.xml.CreateAttribute("UsingYAxis"); |
1683 |
UsingYAxisAttr.Value = pDim.UsingYAxis.ToString(); |
1684 |
DimNode.Attributes.SetNamedItem(UsingYAxisAttr); |
1685 |
|
1686 |
XmlAttribute LeaderEndPointAttr = Program.xml.CreateAttribute("LeaderEndPoint"); |
1687 |
LeaderEndPointAttr.Value = pDim.LeaderEndPoint.ToString(); |
1688 |
DimNode.Attributes.SetNamedItem(LeaderEndPointAttr); |
1689 |
|
1690 |
XmlAttribute OriginAttr = Program.xml.CreateAttribute("Origin"); |
1691 |
OriginAttr.Value = pDim.Origin.ToString(); |
1692 |
DimNode.Attributes.SetNamedItem(OriginAttr); |
1693 |
|
1694 |
dumpDimData(pDim, indent, DimNode); |
1695 |
|
1696 |
return DimNode; |
1697 |
} |
1698 |
|
1699 |
return null; |
1700 |
} |
1701 |
|
1702 |
/************************************************************************/ |
1703 |
/* PolyFaceMesh Dumper */ |
1704 |
/************************************************************************/ |
1705 |
XmlNode dump(PolyFaceMesh pPoly, int indent, XmlNode node) |
1706 |
{ |
1707 |
if (node != null) |
1708 |
{ |
1709 |
XmlElement PolyNode = Program.xml.CreateElement(pPoly.GetRXClass().Name); |
1710 |
|
1711 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
1712 |
HandleAttr.Value = pPoly.Handle.ToString(); |
1713 |
PolyNode.Attributes.SetNamedItem(HandleAttr); |
1714 |
|
1715 |
XmlAttribute NumVerticesAttr = Program.xml.CreateAttribute("NumVertices"); |
1716 |
NumVerticesAttr.Value = pPoly.NumVertices.ToString(); |
1717 |
PolyNode.Attributes.SetNamedItem(NumVerticesAttr); |
1718 |
|
1719 |
XmlAttribute NumFacesAttr = Program.xml.CreateAttribute("NumFaces"); |
1720 |
NumFacesAttr.Value = pPoly.NumFaces.ToString(); |
1721 |
PolyNode.Attributes.SetNamedItem(NumFacesAttr); |
1722 |
|
1723 |
/********************************************************************/ |
1724 |
/* dump vertices and faces */ |
1725 |
/********************************************************************/ |
1726 |
int vertexCount = 0; |
1727 |
int faceCount = 0; |
1728 |
foreach (ObjectId objId in pPoly) |
1729 |
{ |
1730 |
using (Entity ent = (Entity)objId.GetObject(OpenMode.ForRead)) |
1731 |
{ |
1732 |
if (ent is PolyFaceMeshVertex) |
1733 |
{ |
1734 |
PolyFaceMeshVertex pVertex = (PolyFaceMeshVertex)ent; |
1735 |
|
1736 |
XmlElement VertexNode = Program.xml.CreateElement(pVertex.GetRXClass().Name); |
1737 |
|
1738 |
XmlAttribute _HandleAttr = Program.xml.CreateAttribute("Handle"); |
1739 |
_HandleAttr.Value = pVertex.Handle.ToString(); |
1740 |
VertexNode.Attributes.SetNamedItem(_HandleAttr); |
1741 |
|
1742 |
XmlAttribute PositionAttr = Program.xml.CreateAttribute("Position"); |
1743 |
PositionAttr.Value = pVertex.Position.ToString(); |
1744 |
VertexNode.Attributes.SetNamedItem(PositionAttr); |
1745 |
|
1746 |
dumpEntityData(pVertex, indent + 1, VertexNode); |
1747 |
|
1748 |
PolyNode.AppendChild(VertexNode); |
1749 |
} |
1750 |
else if (ent is FaceRecord) |
1751 |
{ |
1752 |
FaceRecord pFace = (FaceRecord)ent; |
1753 |
string face = "{"; |
1754 |
for (short i = 0; i < 4; i++) |
1755 |
{ |
1756 |
if (i > 0) |
1757 |
{ |
1758 |
face = face + " "; |
1759 |
} |
1760 |
face = face + pFace.GetVertexAt(i).ToString(); |
1761 |
} |
1762 |
|
1763 |
face += "}"; |
1764 |
|
1765 |
XmlElement FaceNode = Program.xml.CreateElement(pFace.GetRXClass().Name); |
1766 |
|
1767 |
XmlAttribute _HandleAttr = Program.xml.CreateAttribute("Handle"); |
1768 |
_HandleAttr.Value = pFace.Handle.ToString(); |
1769 |
FaceNode.Attributes.SetNamedItem(_HandleAttr); |
1770 |
FaceNode.InnerText = face; |
1771 |
|
1772 |
dumpEntityData(pFace, indent + 1, FaceNode); |
1773 |
|
1774 |
PolyNode.AppendChild(FaceNode); |
1775 |
} |
1776 |
else |
1777 |
{ // Unknown entity type |
1778 |
writeLine(indent, "Unexpected Entity"); |
1779 |
} |
1780 |
} |
1781 |
} |
1782 |
dumpEntityData(pPoly, indent, PolyNode); |
1783 |
|
1784 |
return PolyNode; |
1785 |
} |
1786 |
|
1787 |
return null; |
1788 |
} |
1789 |
|
1790 |
/************************************************************************/ |
1791 |
/* Ole2Frame */ |
1792 |
/************************************************************************/ |
1793 |
void dump(Ole2Frame pOle, int indent) |
1794 |
{ |
1795 |
writeLine(indent++, pOle.GetRXClass().Name, pOle.Handle); |
1796 |
|
1797 |
Rectangle3d pos = (Rectangle3d)pOle.Position3d; |
1798 |
writeLine(indent, "Lower Left", pos.LowerLeft); |
1799 |
writeLine(indent, "Lower Right", pos.LowerRight); |
1800 |
writeLine(indent, "Upper Left", pos.UpperLeft); |
1801 |
writeLine(indent, "Upper Right", pos.UpperRight); |
1802 |
writeLine(indent, "Type", pOle.Type); |
1803 |
writeLine(indent, "User Type", pOle.UserType); |
1804 |
if (pOle.Type == Ole2Frame.ItemType.Link) |
1805 |
{ |
1806 |
writeLine(indent, "Link Name", pOle.LinkName); |
1807 |
writeLine(indent, "Link Path", pOle.LinkPath); |
1808 |
} |
1809 |
writeLine(indent, "Output Quality", pOle.OutputQuality); |
1810 |
dumpEntityData(pOle, indent, Program.xml.DocumentElement); |
1811 |
} |
1812 |
|
1813 |
/************************************************************************/ |
1814 |
/* Point Dumper */ |
1815 |
/************************************************************************/ |
1816 |
void dump(DBPoint pPoint, int indent) |
1817 |
{ |
1818 |
writeLine(indent++, pPoint.GetRXClass().Name, pPoint.Handle); |
1819 |
writeLine(indent, "Position", pPoint.Position); |
1820 |
writeLine(indent, "ECS Rotation", toDegreeString(pPoint.EcsRotation)); |
1821 |
writeLine(indent, "Normal", pPoint.Normal); |
1822 |
writeLine(indent, "Thickness", pPoint.Thickness); |
1823 |
dumpEntityData(pPoint, indent, Program.xml.DocumentElement); |
1824 |
} |
1825 |
|
1826 |
/************************************************************************/ |
1827 |
/* Polygon Mesh Dumper */ |
1828 |
/************************************************************************/ |
1829 |
void dump(PolygonMesh pPoly, int indent) |
1830 |
{ |
1831 |
writeLine(indent++, pPoly.GetRXClass().Name, pPoly.Handle); |
1832 |
writeLine(indent, "m Size", pPoly.MSize); |
1833 |
writeLine(indent, "m-Closed", pPoly.IsMClosed); |
1834 |
writeLine(indent, "m Surface Density", pPoly.MSurfaceDensity); |
1835 |
writeLine(indent, "n Size", pPoly.NSize); |
1836 |
writeLine(indent, "n-Closed", pPoly.IsNClosed); |
1837 |
writeLine(indent, "n Surface Density", pPoly.NSurfaceDensity); |
1838 |
/********************************************************************/ |
1839 |
/* dump vertices */ |
1840 |
/********************************************************************/ |
1841 |
int vertexCount = 0; |
1842 |
foreach (object o in pPoly) |
1843 |
{ |
1844 |
PolygonMeshVertex pVertex = o as PolygonMeshVertex; |
1845 |
if (pVertex != null) |
1846 |
{ |
1847 |
writeLine(indent, pVertex.GetRXClass().Name, vertexCount++); |
1848 |
writeLine(indent + 1, "Handle", pVertex.Handle); |
1849 |
writeLine(indent + 1, "Position", pVertex.Position); |
1850 |
writeLine(indent + 1, "Type", pVertex.VertexType); |
1851 |
} |
1852 |
} |
1853 |
dumpEntityData(pPoly, indent, Program.xml.DocumentElement); |
1854 |
} |
1855 |
|
1856 |
/************************************************************************/ |
1857 |
/* Polyline Dumper */ |
1858 |
/************************************************************************/ |
1859 |
void dump(Teigha.DatabaseServices.Polyline pPoly, int indent, XmlNode node) |
1860 |
{ |
1861 |
if (pPoly != null && pPoly.Length != 0) |
1862 |
{ |
1863 |
writeLine(indent++, pPoly.GetRXClass().Name, pPoly.Handle); |
1864 |
writeLine(indent, "Has Width", pPoly.HasWidth); |
1865 |
if (!pPoly.HasWidth) |
1866 |
{ |
1867 |
writeLine(indent, "Constant Width", pPoly.ConstantWidth); |
1868 |
} |
1869 |
|
1870 |
/********************************************************************/ |
1871 |
/* dump vertices */ |
1872 |
/********************************************************************/ |
1873 |
if (node != null) |
1874 |
{ |
1875 |
XmlNode PolylineNode = Program.xml.CreateElement(pPoly.GetRXClass().Name); |
1876 |
XmlAttribute LengthAttr = Program.xml.CreateAttribute("Length"); |
1877 |
LengthAttr.Value = pPoly.Length.ToString(); |
1878 |
PolylineNode.Attributes.SetNamedItem(LengthAttr); |
1879 |
|
1880 |
XmlAttribute CountAttr = Program.xml.CreateAttribute("Count"); |
1881 |
CountAttr.Value = pPoly.NumberOfVertices.ToString(); |
1882 |
PolylineNode.Attributes.SetNamedItem(CountAttr); |
1883 |
|
1884 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
1885 |
HandleAttr.Value = pPoly.Handle.ToString(); |
1886 |
PolylineNode.Attributes.SetNamedItem(HandleAttr); |
1887 |
|
1888 |
XmlAttribute ClosedAttr = Program.xml.CreateAttribute("Closed"); |
1889 |
ClosedAttr.Value = pPoly.Closed.ToString(); |
1890 |
PolylineNode.Attributes.SetNamedItem(ClosedAttr); |
1891 |
|
1892 |
for (int i = 0; i < pPoly.NumberOfVertices; i++) |
1893 |
{ |
1894 |
XmlNode VertexNode = Program.xml.CreateElement("Vertex"); |
1895 |
|
1896 |
XmlAttribute SegmentTypeAttr = Program.xml.CreateAttribute("SegmentType"); |
1897 |
SegmentTypeAttr.Value = pPoly.GetSegmentType(i).ToString(); |
1898 |
|
1899 |
Point3d pt = pPoly.GetPoint3dAt(i); |
1900 |
XmlAttribute XAttr = Program.xml.CreateAttribute("X"); |
1901 |
XAttr.Value = pt.X.ToString(); |
1902 |
VertexNode.Attributes.SetNamedItem(XAttr); |
1903 |
|
1904 |
XmlAttribute YAttr = Program.xml.CreateAttribute("Y"); |
1905 |
YAttr.Value = pt.Y.ToString(); |
1906 |
VertexNode.Attributes.SetNamedItem(YAttr); |
1907 |
|
1908 |
XmlAttribute ZAttr = Program.xml.CreateAttribute("Z"); |
1909 |
ZAttr.Value = pt.Z.ToString(); |
1910 |
VertexNode.Attributes.SetNamedItem(ZAttr); |
1911 |
|
1912 |
if (pPoly.HasWidth) |
1913 |
{ |
1914 |
XmlAttribute StartWidthAttr = Program.xml.CreateAttribute("StartWidth"); |
1915 |
StartWidthAttr.Value = pPoly.GetStartWidthAt(i).ToString(); |
1916 |
VertexNode.Attributes.SetNamedItem(StartWidthAttr); |
1917 |
|
1918 |
XmlAttribute EndWidthAttr = Program.xml.CreateAttribute("EndWidth"); |
1919 |
EndWidthAttr.Value = pPoly.GetEndWidthAt(i).ToString(); |
1920 |
VertexNode.Attributes.SetNamedItem(EndWidthAttr); |
1921 |
} |
1922 |
if (pPoly.HasBulges) |
1923 |
{ |
1924 |
XmlAttribute BulgeAttr = Program.xml.CreateAttribute("Bulge"); |
1925 |
BulgeAttr.Value = pPoly.GetBulgeAt(i).ToString(); |
1926 |
VertexNode.Attributes.SetNamedItem(BulgeAttr); |
1927 |
|
1928 |
if (pPoly.GetSegmentType(i) == SegmentType.Arc) |
1929 |
{ |
1930 |
XmlAttribute BulgeAngleAttr = Program.xml.CreateAttribute("BulgeAngle"); |
1931 |
BulgeAngleAttr.Value = pPoly.GetBulgeAt(i).ToString(); |
1932 |
VertexNode.Attributes.SetNamedItem(BulgeAngleAttr); |
1933 |
} |
1934 |
} |
1935 |
|
1936 |
PolylineNode.AppendChild(VertexNode); |
1937 |
} |
1938 |
|
1939 |
dumpEntityData(pPoly, indent, PolylineNode); |
1940 |
node.AppendChild(PolylineNode); |
1941 |
} |
1942 |
} |
1943 |
else |
1944 |
{ |
1945 |
int d = 0; |
1946 |
} |
1947 |
} |
1948 |
|
1949 |
class DrawContextDumper : Context |
1950 |
{ |
1951 |
Database _db; |
1952 |
public DrawContextDumper(Database db) |
1953 |
{ |
1954 |
_db = db; |
1955 |
} |
1956 |
public override Database Database |
1957 |
{ |
1958 |
get { return _db; } |
1959 |
} |
1960 |
public override bool IsBoundaryClipping |
1961 |
{ |
1962 |
get { return false; } |
1963 |
} |
1964 |
public override bool IsPlotGeneration |
1965 |
{ |
1966 |
get { return false; } |
1967 |
} |
1968 |
public override bool IsPostScriptOut |
1969 |
{ |
1970 |
get { return false; } |
1971 |
} |
1972 |
} |
1973 |
class SubEntityTraitsDumper : SubEntityTraits |
1974 |
{ |
1975 |
short _color; |
1976 |
int _drawFlags; |
1977 |
FillType _ft; |
1978 |
ObjectId _layer; |
1979 |
ObjectId _linetype; |
1980 |
LineWeight _lineWeight; |
1981 |
Mapper _mapper; |
1982 |
double _lineTypeScale; |
1983 |
ObjectId _material; |
1984 |
PlotStyleDescriptor _plotStyleDescriptor; |
1985 |
bool _sectionable; |
1986 |
bool _selectionOnlyGeometry; |
1987 |
ShadowFlags _shadowFlags; |
1988 |
double _thickness; |
1989 |
EntityColor _trueColor; |
1990 |
Transparency _transparency; |
1991 |
ObjectId _visualStyle; |
1992 |
public SubEntityTraitsDumper(Database db) |
1993 |
{ |
1994 |
_drawFlags = 0; // kNoDrawFlags |
1995 |
_color = 0; |
1996 |
_ft = FillType.FillAlways; |
1997 |
_layer = db.Clayer; |
1998 |
_linetype = db.Celtype; |
1999 |
_lineWeight = db.Celweight; |
2000 |
_lineTypeScale = db.Celtscale; |
2001 |
_material = db.Cmaterial; |
2002 |
_shadowFlags = ShadowFlags.ShadowsIgnore; |
2003 |
_thickness = 0; |
2004 |
_trueColor = new EntityColor(ColorMethod.None); |
2005 |
_transparency = new Transparency(); |
2006 |
} |
2007 |
|
2008 |
protected override void SetLayerFlags(LayerFlags flags) |
2009 |
{ |
2010 |
writeLine(0, string.Format("SubEntityTraitsDumper.SetLayerFlags(flags = {0})", flags)); |
2011 |
} |
2012 |
public override void AddLight(ObjectId lightId) |
2013 |
{ |
2014 |
writeLine(0, string.Format("SubEntityTraitsDumper.AddLight(lightId = {0})", lightId.ToString())); |
2015 |
} |
2016 |
public override void SetupForEntity(Entity entity) |
2017 |
{ |
2018 |
writeLine(0, string.Format("SubEntityTraitsDumper.SetupForEntity(entity = {0})", entity.ToString())); |
2019 |
} |
2020 |
|
2021 |
public override short Color |
2022 |
{ |
2023 |
get { return _color; } |
2024 |
set { _color = value; } |
2025 |
} |
2026 |
public override int DrawFlags |
2027 |
{ |
2028 |
get { return _drawFlags; } |
2029 |
set { _drawFlags = value; } |
2030 |
} |
2031 |
public override FillType FillType |
2032 |
{ |
2033 |
get { return _ft; } |
2034 |
set { _ft = value; } |
2035 |
} |
2036 |
public override ObjectId Layer |
2037 |
{ |
2038 |
get { return _layer; } |
2039 |
set { _layer = value; } |
2040 |
} |
2041 |
public override ObjectId LineType |
2042 |
{ |
2043 |
get { return _linetype; } |
2044 |
set { _linetype = value; } |
2045 |
} |
2046 |
public override double LineTypeScale |
2047 |
{ |
2048 |
get { return _lineTypeScale; } |
2049 |
set { _lineTypeScale = value; } |
2050 |
} |
2051 |
public override LineWeight LineWeight |
2052 |
{ |
2053 |
get { return _lineWeight; } |
2054 |
set { _lineWeight = value; } |
2055 |
} |
2056 |
public override Mapper Mapper |
2057 |
{ |
2058 |
get { return _mapper; } |
2059 |
set { _mapper = value; } |
2060 |
} |
2061 |
public override ObjectId Material |
2062 |
{ |
2063 |
get { return _material; } |
2064 |
set { _material = value; } |
2065 |
} |
2066 |
public override PlotStyleDescriptor PlotStyleDescriptor |
2067 |
{ |
2068 |
get { return _plotStyleDescriptor; } |
2069 |
set { _plotStyleDescriptor = value; } |
2070 |
} |
2071 |
public override bool Sectionable |
2072 |
{ |
2073 |
get { return _sectionable; } |
2074 |
set { _sectionable = value; } |
2075 |
} |
2076 |
public override bool SelectionOnlyGeometry |
2077 |
{ |
2078 |
get { return _selectionOnlyGeometry; } |
2079 |
set { _selectionOnlyGeometry = value; } |
2080 |
} |
2081 |
public override ShadowFlags ShadowFlags |
2082 |
{ |
2083 |
get { return _shadowFlags; } |
2084 |
set { _shadowFlags = value; } |
2085 |
} |
2086 |
public override double Thickness |
2087 |
{ |
2088 |
get { return _thickness; } |
2089 |
set { _thickness = value; } |
2090 |
} |
2091 |
public override EntityColor TrueColor |
2092 |
{ |
2093 |
get { return _trueColor; } |
2094 |
set { _trueColor = value; } |
2095 |
} |
2096 |
public override Transparency Transparency |
2097 |
{ |
2098 |
get { return _transparency; } |
2099 |
set { _transparency = value; } |
2100 |
} |
2101 |
public override ObjectId VisualStyle |
2102 |
{ |
2103 |
get { return _visualStyle; } |
2104 |
set { _visualStyle = value; } |
2105 |
} |
2106 |
public override void SetSelectionMarker(IntPtr sm) |
2107 |
{ |
2108 |
} |
2109 |
} |
2110 |
class WorldGeometryDumper : WorldGeometry |
2111 |
{ |
2112 |
Stack<Matrix3d> modelMatrix; |
2113 |
Stack<ClipBoundary> clips; |
2114 |
int indent; |
2115 |
public WorldGeometryDumper(int indent) |
2116 |
: base() |
2117 |
{ |
2118 |
this.indent = indent; |
2119 |
modelMatrix = new Stack<Matrix3d>(); |
2120 |
clips = new Stack<ClipBoundary>(); |
2121 |
modelMatrix.Push(Matrix3d.Identity); |
2122 |
} |
2123 |
public override Matrix3d ModelToWorldTransform |
2124 |
{ |
2125 |
get { return modelMatrix.Peek(); } |
2126 |
} |
2127 |
public override Matrix3d WorldToModelTransform |
2128 |
{ |
2129 |
get { return modelMatrix.Peek().Inverse(); } |
2130 |
} |
2131 |
|
2132 |
public override Matrix3d PushOrientationTransform(OrientationBehavior behavior) |
2133 |
{ |
2134 |
writeLine(indent, string.Format("WorldGeometry.PushOrientationTransform(behavior = {0})", behavior)); |
2135 |
return new Matrix3d(); |
2136 |
} |
2137 |
public override Matrix3d PushPositionTransform(PositionBehavior behavior, Point2d offset) |
2138 |
{ |
2139 |
writeLine(indent, string.Format("WorldGeometry.PushPositionTransform(behavior = {0}, offset = {1})", behavior, offset)); |
2140 |
return new Matrix3d(); |
2141 |
} |
2142 |
public override Matrix3d PushPositionTransform(PositionBehavior behavior, Point3d offset) |
2143 |
{ |
2144 |
writeLine(indent, string.Format("WorldGeometry.PushPositionTransform(behavior = {0}, offset = {1})", behavior, offset)); |
2145 |
return new Matrix3d(); |
2146 |
} |
2147 |
public override bool OwnerDraw(GdiDrawObject gdiDrawObject, Point3d position, Vector3d u, Vector3d v) |
2148 |
{ |
2149 |
writeLine(indent, string.Format("WorldGeometry.OwnerDraw(gdiDrawObject = {0}, position = {1}, u = {2}, v = {3})", gdiDrawObject, position, u, v)); |
2150 |
return false; |
2151 |
} |
2152 |
public override bool Polyline(Teigha.GraphicsInterface.Polyline polylineObj) |
2153 |
{ |
2154 |
writeLine(indent, string.Format("WorldGeometry.Polyline(value = {0}", polylineObj)); |
2155 |
return false; |
2156 |
} |
2157 |
public override bool Polypoint(Point3dCollection points, Vector3dCollection normals, IntPtrCollection subentityMarkers) |
2158 |
{ |
2159 |
writeLine(indent, string.Format("WorldGeometry.Polypoint(points = {0}, normals = {1}, subentityMarkers = {2}", points, normals, subentityMarkers)); |
2160 |
return false; |
2161 |
} |
2162 |
public override bool Polypoint(Point3dCollection points, EntityColorCollection colors, Vector3dCollection normals, IntPtrCollection subentityMarkers) |
2163 |
{ |
2164 |
writeLine(indent, string.Format("WorldGeometry.Polypoint(points = {0}, colors = {1}, normals = {2}, subentityMarkers = {3}", points, colors, normals, subentityMarkers)); |
2165 |
return false; |
2166 |
} |
2167 |
public override bool Polypoint(Point3dCollection points, EntityColorCollection colors, TransparencyCollection transparency, Vector3dCollection normals, IntPtrCollection subentityMarkers, int pointSize) |
2168 |
{ |
2169 |
writeLine(indent, string.Format("WorldGeometry.Polypoint(points = {0}, colors = {1}, transparency = {2}, normals = {3}, subentityMarkers = {4}, pointSize = {5}", points, colors, transparency, normals, subentityMarkers, pointSize)); |
2170 |
return false; |
2171 |
} |
2172 |
public override bool PolyPolyline(Teigha.GraphicsInterface.PolylineCollection polylineCollection) |
2173 |
{ |
2174 |
writeLine(indent, string.Format("WorldGeometry.PolyPolyline(polylineCollection = {0}", polylineCollection)); |
2175 |
return false; |
2176 |
} |
2177 |
public override bool PolyPolygon(UInt32Collection numPolygonPositions, Point3dCollection polygonPositions, UInt32Collection numPolygonPoints, Point3dCollection polygonPoints, EntityColorCollection outlineColors, LinetypeCollection outlineTypes, EntityColorCollection fillColors, Teigha.Colors.TransparencyCollection fillOpacities) |
2178 |
{ |
2179 |
writeLine(indent, string.Format("WorldGeometry.PolyPolygon(numPolygonPositions = {0}, polygonPositions = {1}, numPolygonPoints = {2}, polygonPoints = {3}, outlineColors = {4}, outlineTypes = {5}, fillColors = {6}, fillOpacities = {7})", numPolygonPositions, polygonPositions, numPolygonPoints, polygonPoints, outlineColors, outlineTypes, fillColors, fillOpacities)); |
2180 |
return false; |
2181 |
} |
2182 |
public override Matrix3d PushScaleTransform(ScaleBehavior behavior, Point2d extents) |
2183 |
{ |
2184 |
writeLine(indent, string.Format("WorldGeometry.PushScaleTransform(behavior = {0}, extents = {1})", behavior, extents)); |
2185 |
return new Matrix3d(); |
2186 |
} |
2187 |
public override Matrix3d PushScaleTransform(ScaleBehavior behavior, Point3d extents) |
2188 |
{ |
2189 |
writeLine(indent, string.Format("WorldGeometry.PushScaleTransform(behavior = {0}, extents = {1})", behavior, extents)); |
2190 |
return new Matrix3d(); |
2191 |
} |
2192 |
public override bool EllipticalArc(Point3d center, Vector3d normal, double majorAxisLength, double minorAxisLength, double startDegreeInRads, double endDegreeInRads, double tiltDegreeInRads, ArcType arType) |
2193 |
{ |
2194 |
writeLine(indent, string.Format("WorldGeometry.EllipticalArc(center = {0}, normal = {1}, majorAxisLength = {2}, minorAxisLength = {3}, startDegreeInRads = {4}, endDegreeInRads = {5}, tiltDegreeInRads = {6}, arType = {7}", center, normal, majorAxisLength, minorAxisLength, startDegreeInRads, endDegreeInRads, tiltDegreeInRads, arType)); |
2195 |
return false; |
2196 |
} |
2197 |
public override bool Circle(Point3d center, double radius, Vector3d normal) |
2198 |
{ |
2199 |
writeLine(indent, string.Format("WorldGeometry.Circle(center = {0}, radius = {1}, normal = {2})", center, radius, normal)); |
2200 |
return false; |
2201 |
} |
2202 |
public override bool Circle(Point3d firstPoint, Point3d secondPoint, Point3d thirdPoint) |
2203 |
{ |
2204 |
writeLine(indent, string.Format("WorldGeometry.Circle(firstPoint = {0}, secondPoint = {1}, thirdPoint = {2})", firstPoint, secondPoint, thirdPoint)); |
2205 |
return false; |
2206 |
} |
2207 |
public override bool CircularArc(Point3d start, Point3d point, Point3d endingPoint, ArcType arcType) |
2208 |
{ |
2209 |
writeLine(indent, string.Format("WorldGeometry.CircularArc(start = {0}, point = {1}, endingPoint = {2}, arcType = {3})", start, point, endingPoint, arcType)); |
2210 |
return false; |
2211 |
} |
2212 |
public override bool CircularArc(Point3d center, double radius, Vector3d normal, Vector3d startVector, double sweepAngle, ArcType arcType) |
2213 |
{ |
2214 |
writeLine(indent, string.Format("WorldGeometry.CircularArc(center = {0}, radius = {1}, normal = {2}, startVector = {3}, sweepAngle = {4}, arcType = {5}", center, radius, normal, startVector, sweepAngle, arcType)); |
2215 |
return false; |
2216 |
} |
2217 |
public override bool Draw(Drawable value) |
2218 |
{ |
2219 |
writeLine(indent, string.Format("WorldGeometry.Draw(value = {0}", value)); |
2220 |
return false; |
2221 |
} |
2222 |
public override bool Image(ImageBGRA32 imageSource, Point3d position, Vector3d u, Vector3d v) |
2223 |
{ |
2224 |
writeLine(indent, string.Format("WorldGeometry.Image(imageSource = , position = {1}, Vector3d = {2}, Vector3d = {3}", position, u, v)); |
2225 |
return false; |
2226 |
} |
2227 |
public override bool Image(ImageBGRA32 imageSource, Point3d position, Vector3d u, Vector3d v, TransparencyMode transparencyMode) |
2228 |
{ |
2229 |
writeLine(indent, string.Format("WorldGeometry.Image(imageSource = , position = {1}, Vector3d = {2}, Vector3d = {3}, transparencyMode = {4}", position, u, v, transparencyMode)); |
2230 |
return false; |
2231 |
} |
2232 |
public override bool Mesh(int rows, int columns, Point3dCollection points, EdgeData edgeData, FaceData faceData, VertexData vertexData, bool bAutoGenerateNormals) |
2233 |
{ |
2234 |
writeLine(indent, string.Format("WorldGeometry.Mesh(rows = {0}, columns = {1}, points = {2}, edgeData = {3}, faceData = {4}, vertexData = {5}, bAutoGenerateNormals = {6})", rows, columns, points, edgeData, faceData, vertexData, bAutoGenerateNormals)); |
2235 |
return false; |
2236 |
} |
2237 |
public override bool Polygon(Point3dCollection points) |
2238 |
{ |
2239 |
writeLine(indent, string.Format("WorldGeometry.Polygon(points = {0})", points)); |
2240 |
return false; |
2241 |
} |
2242 |
public override bool Polyline(Teigha.DatabaseServices.Polyline value, int fromIndex, int segments) |
2243 |
{ |
2244 |
writeLine(indent, string.Format("WorldGeometry.Polyline(value = {0}, fromIndex = {1}, segments = {2})", value, fromIndex, segments)); |
2245 |
return false; |
2246 |
} |
2247 |
public override bool Polyline(Point3dCollection points, Vector3d normal, IntPtr subEntityMarker) |
2248 |
{ |
2249 |
writeLine(indent, string.Format("WorldGeometry.Polyline(points = {0}, normal = {1}, subEntityMarker = {2})", points, normal, subEntityMarker)); |
2250 |
return false; |
2251 |
} |
2252 |
public override void PopClipBoundary() |
2253 |
{ |
2254 |
writeLine(indent, string.Format("WorldGeometry.PopClipBoundary")); |
2255 |
clips.Pop(); |
2256 |
} |
2257 |
public override bool PopModelTransform() |
2258 |
{ |
2259 |
return true; |
2260 |
} |
2261 |
public override bool PushClipBoundary(ClipBoundary boundary) |
2262 |
{ |
2263 |
writeLine(indent, string.Format("WorldGeometry.PushClipBoundary")); |
2264 |
clips.Push(boundary); |
2265 |
return true; |
2266 |
} |
2267 |
public override bool PushModelTransform(Matrix3d matrix) |
2268 |
{ |
2269 |
writeLine(indent, "WorldGeometry.PushModelTransform(Matrix3d)"); |
2270 |
Matrix3d m = modelMatrix.Peek(); |
2271 |
modelMatrix.Push(m * matrix); |
2272 |
return true; |
2273 |
} |
2274 |
public override bool PushModelTransform(Vector3d normal) |
2275 |
{ |
2276 |
writeLine(indent, "WorldGeometry.PushModelTransform(Vector3d)"); |
2277 |
PushModelTransform(Matrix3d.PlaneToWorld(normal)); |
2278 |
return true; |
2279 |
} |
2280 |
public override bool RowOfDots(int count, Point3d start, Vector3d step) |
2281 |
{ |
2282 |
writeLine(indent, string.Format("ViewportGeometry.RowOfDots(count = {0}, start = {1}, step = {1})", count, start, step)); |
2283 |
return false; |
2284 |
} |
2285 |
public override bool Ray(Point3d point1, Point3d point2) |
2286 |
{ |
2287 |
writeLine(indent, string.Format("WorldGeometry.Ray(point1 = {0}, point2 = {1})", point1, point2)); |
2288 |
return false; |
2289 |
} |
2290 |
public override bool Shell(Point3dCollection points, IntegerCollection faces, EdgeData edgeData, FaceData faceData, VertexData vertexData, bool bAutoGenerateNormals) |
2291 |
{ |
2292 |
writeLine(indent, string.Format("WorldGeometry.Shell(points = {0}, faces = {1}, edgeData = {2}, faceData = {3}, vertexData = {4}, bAutoGenerateNormals = {5})", points, faces, edgeData, faceData, vertexData, bAutoGenerateNormals)); |
2293 |
return false; |
2294 |
} |
2295 |
public override bool Text(Point3d position, Vector3d normal, Vector3d direction, string message, bool raw, TextStyle textStyle) |
2296 |
{ |
2297 |
writeLine(indent, string.Format("WorldGeometry.Text(position = {0}, normal = {1}, direction = {2}, message = {3}, raw = {4}, textStyle = {5})", position, normal, direction, message, raw, textStyle)); |
2298 |
return false; |
2299 |
} |
2300 |
public override bool Text(Point3d position, Vector3d normal, Vector3d direction, double height, double width, double oblique, string message) |
2301 |
{ |
2302 |
writeLine(indent, string.Format("WorldGeometry.Text(position = {0}, normal = {1}, direction = {2}, height = {3}, width = {4}, oblique = {5}, message = {6})", position, normal, direction, height, width, oblique, message)); |
2303 |
return false; |
2304 |
} |
2305 |
public override bool WorldLine(Point3d startPoint, Point3d endPoint) |
2306 |
{ |
2307 |
writeLine(indent, string.Format("WorldGeometry.WorldLine(startPoint = {0}, endPoint = {1})", startPoint, endPoint)); |
2308 |
return false; |
2309 |
} |
2310 |
public override bool Xline(Point3d point1, Point3d point2) |
2311 |
{ |
2312 |
writeLine(indent, string.Format("WorldGeometry.Xline(point1 = {0}, point2 = {1})", point1, point2)); |
2313 |
return false; |
2314 |
} |
2315 |
|
2316 |
public override void SetExtents(Extents3d extents) |
2317 |
{ |
2318 |
writeLine(indent, "WorldGeometry.SetExtents({0}) ", extents); |
2319 |
} |
2320 |
public override void StartAttributesSegment() |
2321 |
{ |
2322 |
writeLine(indent, "WorldGeometry.StartAttributesSegment called"); |
2323 |
} |
2324 |
} |
2325 |
|
2326 |
class WorldDrawDumper : WorldDraw |
2327 |
{ |
2328 |
WorldGeometryDumper _geom; |
2329 |
DrawContextDumper _ctx; |
2330 |
SubEntityTraits _subents; |
2331 |
RegenType _regenType; |
2332 |
int indent; |
2333 |
public WorldDrawDumper(Database db, int indent) |
2334 |
: base() |
2335 |
{ |
2336 |
_regenType = RegenType; |
2337 |
this.indent = indent; |
2338 |
_geom = new WorldGeometryDumper(indent); |
2339 |
_ctx = new DrawContextDumper(db); |
2340 |
_subents = new SubEntityTraitsDumper(db); |
2341 |
} |
2342 |
public override double Deviation(DeviationType deviationType, Point3d pointOnCurve) |
2343 |
{ |
2344 |
return 1e-9; |
2345 |
} |
2346 |
public override WorldGeometry Geometry |
2347 |
{ |
2348 |
get |
2349 |
{ |
2350 |
return _geom; |
2351 |
} |
2352 |
} |
2353 |
public override bool IsDragging |
2354 |
{ |
2355 |
get |
2356 |
{ |
2357 |
return false; |
2358 |
} |
2359 |
} |
2360 |
public override Int32 NumberOfIsolines |
2361 |
{ |
2362 |
get |
2363 |
{ |
2364 |
return 10; |
2365 |
} |
2366 |
} |
2367 |
public override Geometry RawGeometry |
2368 |
{ |
2369 |
get |
2370 |
{ |
2371 |
return _geom; |
2372 |
} |
2373 |
} |
2374 |
public override bool RegenAbort |
2375 |
{ |
2376 |
get |
2377 |
{ |
2378 |
return false; |
2379 |
} |
2380 |
} |
2381 |
public override RegenType RegenType |
2382 |
{ |
2383 |
get |
2384 |
{ |
2385 |
writeLine(indent, "RegenType is asked"); |
2386 |
return _regenType; |
2387 |
} |
2388 |
} |
2389 |
public override SubEntityTraits SubEntityTraits |
2390 |
{ |
2391 |
get |
2392 |
{ |
2393 |
return _subents; |
2394 |
} |
2395 |
} |
2396 |
public override Context Context |
2397 |
{ |
2398 |
get |
2399 |
{ |
2400 |
return _ctx; |
2401 |
} |
2402 |
} |
2403 |
} |
2404 |
|
2405 |
/************************************************************************/ |
2406 |
/* Dump the common data and WorldDraw information for all */ |
2407 |
/* entities without explicit dumpers */ |
2408 |
/************************************************************************/ |
2409 |
XmlNode dump(Entity pEnt, int indent, XmlNode node) |
2410 |
{ |
2411 |
if (node != null) |
2412 |
{ |
2413 |
XmlElement EntNode = Program.xml.CreateElement(pEnt.GetRXClass().Name); |
2414 |
|
2415 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
2416 |
HandleAttr.Value = pEnt.Handle.ToString(); |
2417 |
EntNode.Attributes.SetNamedItem(HandleAttr); |
2418 |
|
2419 |
dumpEntityData(pEnt, indent, EntNode); |
2420 |
using (Database db = pEnt.Database) |
2421 |
{ |
2422 |
/**********************************************************************/ |
2423 |
/* Create an OdGiWorldDraw instance for the vectorization */ |
2424 |
/**********************************************************************/ |
2425 |
WorldDrawDumper wd = new WorldDrawDumper(db, indent + 1); |
2426 |
/**********************************************************************/ |
2427 |
/* Call worldDraw() */ |
2428 |
/**********************************************************************/ |
2429 |
pEnt.WorldDraw(wd); |
2430 |
} |
2431 |
|
2432 |
node.AppendChild(EntNode); |
2433 |
|
2434 |
return EntNode; |
2435 |
} |
2436 |
|
2437 |
return null; |
2438 |
} |
2439 |
|
2440 |
/************************************************************************/ |
2441 |
/* Proxy Entity Dumper */ |
2442 |
/************************************************************************/ |
2443 |
XmlNode dump(ProxyEntity pProxy, int indent, XmlNode node) |
2444 |
{ |
2445 |
if (node != null) |
2446 |
{ |
2447 |
XmlElement ProxyNode = Program.xml.CreateElement(pProxy.GetRXClass().Name); |
2448 |
|
2449 |
XmlAttribute OriginalClassNameAttr = Program.xml.CreateAttribute("OriginalClassName"); |
2450 |
OriginalClassNameAttr.Value = pProxy.OriginalClassName.ToString(); |
2451 |
ProxyNode.Attributes.SetNamedItem(OriginalClassNameAttr); |
2452 |
|
2453 |
// this will dump proxy entity graphics |
2454 |
dump((Entity)pProxy, indent, node); |
2455 |
|
2456 |
DBObjectCollection collection = new DBObjectCollection(); ; |
2457 |
try |
2458 |
{ |
2459 |
pProxy.ExplodeGeometry(collection); |
2460 |
} |
2461 |
catch (System.Exception) |
2462 |
{ |
2463 |
return null; |
2464 |
} |
2465 |
|
2466 |
foreach (Entity ent in collection) |
2467 |
{ |
2468 |
if (ent is Polyline2d) |
2469 |
{ |
2470 |
Polyline2d pline2d = (Polyline2d)ent; |
2471 |
int i = 0; |
2472 |
|
2473 |
try |
2474 |
{ |
2475 |
foreach (Entity ent1 in pline2d) |
2476 |
{ |
2477 |
if (ent1 is Vertex2d) |
2478 |
{ |
2479 |
Vertex2d vtx2d = (Vertex2d)ent1; |
2480 |
dump2dVertex(indent, vtx2d, i++, ProxyNode); |
2481 |
} |
2482 |
} |
2483 |
} |
2484 |
catch (System.Exception) |
2485 |
{ |
2486 |
return null; |
2487 |
} |
2488 |
} |
2489 |
} |
2490 |
|
2491 |
node.AppendChild(ProxyNode); |
2492 |
return ProxyNode; |
2493 |
} |
2494 |
|
2495 |
return null; |
2496 |
} |
2497 |
|
2498 |
/************************************************************************/ |
2499 |
/* Radial Dimension Dumper */ |
2500 |
/************************************************************************/ |
2501 |
XmlNode dump(RadialDimension pDim, int indent, XmlNode node) |
2502 |
{ |
2503 |
if (node != null) |
2504 |
{ |
2505 |
XmlElement DimNode = Program.xml.CreateElement(pDim.GetRXClass().Name); |
2506 |
|
2507 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
2508 |
HandleAttr.Value = pDim.Handle.ToString(); |
2509 |
DimNode.Attributes.SetNamedItem(HandleAttr); |
2510 |
|
2511 |
XmlAttribute CenterAttr = Program.xml.CreateAttribute("Center"); |
2512 |
CenterAttr.Value = pDim.Center.ToString(); |
2513 |
DimNode.Attributes.SetNamedItem(CenterAttr); |
2514 |
|
2515 |
XmlAttribute ChordPointAttr = Program.xml.CreateAttribute("ChordPoint"); |
2516 |
ChordPointAttr.Value = pDim.ChordPoint.ToString(); |
2517 |
DimNode.Attributes.SetNamedItem(ChordPointAttr); |
2518 |
|
2519 |
XmlAttribute LeaderLengthAttr = Program.xml.CreateAttribute("LeaderLength"); |
2520 |
LeaderLengthAttr.Value = pDim.LeaderLength.ToString(); |
2521 |
DimNode.Attributes.SetNamedItem(LeaderLengthAttr); |
2522 |
|
2523 |
dumpDimData(pDim, indent, DimNode); |
2524 |
|
2525 |
node.AppendChild(DimNode); |
2526 |
|
2527 |
return DimNode; |
2528 |
} |
2529 |
|
2530 |
return null; |
2531 |
} |
2532 |
|
2533 |
/************************************************************************/ |
2534 |
/* Dump Raster Image Def */ |
2535 |
/************************************************************************/ |
2536 |
void dumpRasterImageDef(ObjectId id, int indent) |
2537 |
{ |
2538 |
if (!id.IsValid) |
2539 |
return; |
2540 |
using (RasterImageDef pDef = (RasterImageDef)id.Open(OpenMode.ForRead)) |
2541 |
{ |
2542 |
writeLine(indent++, pDef.GetRXClass().Name, pDef.Handle); |
2543 |
writeLine(indent, "Source Filename", shortenPath(pDef.SourceFileName)); |
2544 |
writeLine(indent, "Loaded", pDef.IsLoaded); |
2545 |
writeLine(indent, "mm per Pixel", pDef.ResolutionMMPerPixel); |
2546 |
writeLine(indent, "Loaded", pDef.IsLoaded); |
2547 |
writeLine(indent, "Resolution Units", pDef.ResolutionUnits); |
2548 |
writeLine(indent, "Size", pDef.Size); |
2549 |
} |
2550 |
} |
2551 |
/************************************************************************/ |
2552 |
/* Dump Raster Image Data */ |
2553 |
/************************************************************************/ |
2554 |
void dumpRasterImageData(RasterImage pImage, int indent) |
2555 |
{ |
2556 |
writeLine(indent, "Brightness", pImage.Brightness); |
2557 |
writeLine(indent, "Clipped", pImage.IsClipped); |
2558 |
writeLine(indent, "Contrast", pImage.Contrast); |
2559 |
writeLine(indent, "Fade", pImage.Fade); |
2560 |
writeLine(indent, "kClip", pImage.DisplayOptions & ImageDisplayOptions.Clip); |
2561 |
writeLine(indent, "kShow", pImage.DisplayOptions & ImageDisplayOptions.Show); |
2562 |
writeLine(indent, "kShowUnAligned", pImage.DisplayOptions & ImageDisplayOptions.ShowUnaligned); |
2563 |
writeLine(indent, "kTransparent", pImage.DisplayOptions & ImageDisplayOptions.Transparent); |
2564 |
writeLine(indent, "Scale", pImage.Scale); |
2565 |
|
2566 |
/********************************************************************/ |
2567 |
/* Dump clip boundary */ |
2568 |
/********************************************************************/ |
2569 |
if (pImage.IsClipped) |
2570 |
{ |
2571 |
writeLine(indent, "Clip Boundary Type", pImage.ClipBoundaryType); |
2572 |
if (pImage.ClipBoundaryType != ClipBoundaryType.Invalid) |
2573 |
{ |
2574 |
Point2dCollection pt = pImage.GetClipBoundary(); |
2575 |
for (int i = 0; i < pt.Count; i++) |
2576 |
{ |
2577 |
writeLine(indent, string.Format("Clip Point {0}", i), pt[i]); |
2578 |
} |
2579 |
} |
2580 |
} |
2581 |
|
2582 |
/********************************************************************/ |
2583 |
/* Dump frame */ |
2584 |
/********************************************************************/ |
2585 |
Point3dCollection vertices = pImage.GetVertices(); |
2586 |
for (int i = 0; i < vertices.Count; i++) |
2587 |
{ |
2588 |
writeLine(indent, "Frame Vertex " + i.ToString(), vertices[i]); |
2589 |
} |
2590 |
|
2591 |
/********************************************************************/ |
2592 |
/* Dump orientation */ |
2593 |
/********************************************************************/ |
2594 |
writeLine(indent, "Orientation"); |
2595 |
writeLine(indent + 1, "Origin", pImage.Orientation.Origin); |
2596 |
writeLine(indent + 1, "uVector", pImage.Orientation.Xaxis); |
2597 |
writeLine(indent + 1, "vVector", pImage.Orientation.Yaxis); |
2598 |
dumpRasterImageDef(pImage.ImageDefId, indent); |
2599 |
dumpEntityData(pImage, indent, Program.xml.DocumentElement); |
2600 |
} |
2601 |
|
2602 |
/************************************************************************/ |
2603 |
/* Raster Image Dumper */ |
2604 |
/************************************************************************/ |
2605 |
void dump(RasterImage pImage, int indent) |
2606 |
{ |
2607 |
writeLine(indent++, pImage.GetRXClass().Name, pImage.Handle); |
2608 |
writeLine(indent, "Image size", pImage.ImageSize(true)); |
2609 |
dumpRasterImageData(pImage, indent); |
2610 |
} |
2611 |
|
2612 |
/************************************************************************/ |
2613 |
/* Ray Dumper */ |
2614 |
/************************************************************************/ |
2615 |
void dump(Ray pRay, int indent) |
2616 |
{ |
2617 |
writeLine(indent++, pRay.GetRXClass().Name, pRay.Handle); |
2618 |
writeLine(indent, "Base Point", pRay.BasePoint); |
2619 |
writeLine(indent, "Unit Direction", pRay.UnitDir); |
2620 |
dumpCurveData(pRay, indent, Program.xml.DocumentElement); |
2621 |
} |
2622 |
|
2623 |
/************************************************************************/ |
2624 |
/* Region Dumper */ |
2625 |
/************************************************************************/ |
2626 |
void dump(Region pRegion, int indent) |
2627 |
{ |
2628 |
writeLine(indent++, pRegion.GetRXClass().Name, pRegion.Handle); |
2629 |
dumpEntityData(pRegion, indent, Program.xml.DocumentElement); |
2630 |
} |
2631 |
|
2632 |
/************************************************************************/ |
2633 |
/* Rotated Dimension Dumper */ |
2634 |
/************************************************************************/ |
2635 |
XmlNode dump(RotatedDimension pDim, int indent, XmlNode node) |
2636 |
{ |
2637 |
if (node != null) |
2638 |
{ |
2639 |
XmlElement DimNode = Program.xml.CreateElement(pDim.GetRXClass().Name); |
2640 |
|
2641 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
2642 |
HandleAttr.Value = pDim.Handle.ToString(); |
2643 |
DimNode.Attributes.SetNamedItem(HandleAttr); |
2644 |
|
2645 |
XmlAttribute DimLinePointAttr = Program.xml.CreateAttribute("DimLinePoint"); |
2646 |
DimLinePointAttr.Value = pDim.DimLinePoint.ToString(); |
2647 |
DimNode.Attributes.SetNamedItem(DimLinePointAttr); |
2648 |
|
2649 |
XmlAttribute ObliqueAttr = Program.xml.CreateAttribute("Oblique"); |
2650 |
ObliqueAttr.Value = pDim.Oblique.ToString(); |
2651 |
DimNode.Attributes.SetNamedItem(ObliqueAttr); |
2652 |
|
2653 |
XmlAttribute RotationAttr = Program.xml.CreateAttribute("Rotation"); |
2654 |
RotationAttr.Value = pDim.Rotation.ToString(); |
2655 |
DimNode.Attributes.SetNamedItem(RotationAttr); |
2656 |
|
2657 |
XmlAttribute XLine1PointAttr = Program.xml.CreateAttribute("XLine1Point"); |
2658 |
XLine1PointAttr.Value = pDim.XLine1Point.ToString(); |
2659 |
DimNode.Attributes.SetNamedItem(XLine1PointAttr); |
2660 |
|
2661 |
XmlAttribute XLine2PointAttr = Program.xml.CreateAttribute("XLine2Point"); |
2662 |
XLine2PointAttr.Value = pDim.XLine2Point.ToString(); |
2663 |
DimNode.Attributes.SetNamedItem(XLine2PointAttr); |
2664 |
|
2665 |
dumpDimData(pDim, indent, DimNode); |
2666 |
node.AppendChild(DimNode); |
2667 |
|
2668 |
return DimNode; |
2669 |
} |
2670 |
|
2671 |
return null; |
2672 |
} |
2673 |
|
2674 |
/************************************************************************/ |
2675 |
/* Shape Dumper */ |
2676 |
/************************************************************************/ |
2677 |
void dump(Shape pShape, int indent) |
2678 |
{ |
2679 |
writeLine(indent++, pShape.GetRXClass().Name, pShape.Handle); |
2680 |
|
2681 |
if (!pShape.StyleId.IsNull) |
2682 |
{ |
2683 |
using (TextStyleTableRecord pStyle = (TextStyleTableRecord)pShape.StyleId.Open(OpenMode.ForRead)) |
2684 |
writeLine(indent, "Filename", shortenPath(pStyle.FileName)); |
2685 |
} |
2686 |
|
2687 |
writeLine(indent, "Shape Number", pShape.ShapeNumber); |
2688 |
writeLine(indent, "Shape Name", pShape.Name); |
2689 |
writeLine(indent, "Position", pShape.Position); |
2690 |
writeLine(indent, "Size", pShape.Size); |
2691 |
writeLine(indent, "Rotation", toDegreeString(pShape.Rotation)); |
2692 |
writeLine(indent, "Oblique", toDegreeString(pShape.Oblique)); |
2693 |
writeLine(indent, "Normal", pShape.Normal); |
2694 |
writeLine(indent, "Thickness", pShape.Thickness); |
2695 |
dumpEntityData(pShape, indent, Program.xml.DocumentElement); |
2696 |
} |
2697 |
|
2698 |
/************************************************************************/ |
2699 |
/* Solid Dumper */ |
2700 |
/************************************************************************/ |
2701 |
// TODO: |
2702 |
/* void dump(Solid pSolid, int indent) |
2703 |
{ |
2704 |
writeLine(indent++, pSolid.GetRXClass().Name, pSolid.Handle); |
2705 |
|
2706 |
for (int i = 0; i < 4; i++) |
2707 |
{ |
2708 |
writeLine(indent, "Point " + i.ToString(), pSolid .GetPointAt(i)); |
2709 |
} |
2710 |
dumpEntityData(pSolid, indent); |
2711 |
} |
2712 |
*/ |
2713 |
/************************************************************************/ |
2714 |
/* Spline Dumper */ |
2715 |
/************************************************************************/ |
2716 |
void dump(Spline pSpline, int indent) |
2717 |
{ |
2718 |
writeLine(indent++, pSpline.GetRXClass().Name, pSpline.Handle); |
2719 |
|
2720 |
NurbsData data = pSpline.NurbsData; |
2721 |
writeLine(indent, "Degree", data.Degree); |
2722 |
writeLine(indent, "Rational", data.Rational); |
2723 |
writeLine(indent, "Periodic", data.Periodic); |
2724 |
writeLine(indent, "Control Point Tolerance", data.ControlPointTolerance); |
2725 |
writeLine(indent, "Knot Tolerance", data.KnotTolerance); |
2726 |
|
2727 |
writeLine(indent, "Number of control points", data.GetControlPoints().Count); |
2728 |
for (int i = 0; i < data.GetControlPoints().Count; i++) |
2729 |
{ |
2730 |
writeLine(indent, "Control Point " + i.ToString(), data.GetControlPoints()[i]); |
2731 |
} |
2732 |
|
2733 |
writeLine(indent, "Number of Knots", data.GetKnots().Count); |
2734 |
for (int i = 0; i < data.GetKnots().Count; i++) |
2735 |
{ |
2736 |
writeLine(indent, "Knot " + i.ToString(), data.GetKnots()[i]); |
2737 |
} |
2738 |
|
2739 |
if (data.Rational) |
2740 |
{ |
2741 |
writeLine(indent, "Number of Weights", data.GetWeights().Count); |
2742 |
for (int i = 0; i < data.GetWeights().Count; i++) |
2743 |
{ |
2744 |
writeLine(indent, "Weight " + i.ToString(), data.GetWeights()[i]); |
2745 |
} |
2746 |
} |
2747 |
dumpCurveData(pSpline, indent, Program.xml.DocumentElement); |
2748 |
} |
2749 |
/************************************************************************/ |
2750 |
/* Table Dumper */ |
2751 |
/************************************************************************/ |
2752 |
void dump(Table pTable, int indent) |
2753 |
{ |
2754 |
writeLine(indent++, pTable.GetRXClass().Name, pTable.Handle); |
2755 |
writeLine(indent, "Position", pTable.Position); |
2756 |
writeLine(indent, "X-Direction", pTable.Direction); |
2757 |
writeLine(indent, "Normal", pTable.Normal); |
2758 |
writeLine(indent, "Height", (int)pTable.Height); |
2759 |
writeLine(indent, "Width", (int)pTable.Width); |
2760 |
writeLine(indent, "Rows", (int)pTable.NumRows); |
2761 |
writeLine(indent, "Columns", (int)pTable.NumColumns); |
2762 |
|
2763 |
// TODO: |
2764 |
//TableStyle pStyle = (TableStyle)pTable.TableStyle.Open(OpenMode.ForRead); |
2765 |
//writeLine(indent, "Table Style", pStyle.Name); |
2766 |
dumpEntityData(pTable, indent, Program.xml.DocumentElement); |
2767 |
} |
2768 |
|
2769 |
/************************************************************************/ |
2770 |
/* Text Dumper */ |
2771 |
/************************************************************************/ |
2772 |
static void dump(DBText pText, int indent, XmlNode node) |
2773 |
{ |
2774 |
if (node != null) |
2775 |
{ |
2776 |
dumpTextData(pText, indent, node); |
2777 |
} |
2778 |
} |
2779 |
/************************************************************************/ |
2780 |
/* Trace Dumper */ |
2781 |
/************************************************************************/ |
2782 |
void dump(Trace pTrace, int indent) |
2783 |
{ |
2784 |
writeLine(indent++, pTrace.GetRXClass().Name, pTrace.Handle); |
2785 |
|
2786 |
for (short i = 0; i < 4; i++) |
2787 |
{ |
2788 |
writeLine(indent, "Point " + i.ToString(), pTrace.GetPointAt(i)); |
2789 |
} |
2790 |
dumpEntityData(pTrace, indent, Program.xml.DocumentElement); |
2791 |
} |
2792 |
|
2793 |
/************************************************************************/ |
2794 |
/* Trace UnderlayReference */ |
2795 |
/************************************************************************/ |
2796 |
void dump(UnderlayReference pEnt, int indent) |
2797 |
{ |
2798 |
writeLine(indent++, pEnt.GetRXClass().Name, pEnt.Handle); |
2799 |
writeLine(indent, "UnderlayReference Path ", pEnt.Path); |
2800 |
writeLine(indent, "UnderlayReference Position ", pEnt.Position); |
2801 |
} |
2802 |
|
2803 |
/************************************************************************/ |
2804 |
/* Viewport Dumper */ |
2805 |
/************************************************************************/ |
2806 |
XmlNode dump(Teigha.DatabaseServices.Viewport pVport, int indent, XmlNode node) |
2807 |
{ |
2808 |
if (node != null) |
2809 |
{ |
2810 |
XmlElement VportNode = Program.xml.CreateElement(pVport.GetRXClass().Name); |
2811 |
|
2812 |
XmlAttribute HandleAttr = Program.xml.CreateAttribute("Handle"); |
2813 |
HandleAttr.Value = pVport.Handle.ToString(); |
2814 |
VportNode.Attributes.SetNamedItem(HandleAttr); |
2815 |
|
2816 |
writeLine(indent, "Back Clip Distance", pVport.BackClipDistance); |
2817 |
writeLine(indent, "Back Clip On", pVport.BackClipOn); |
2818 |
writeLine(indent, "Center Point", pVport.CenterPoint); |
2819 |
writeLine(indent, "Circle sides", pVport.CircleSides); |
2820 |
writeLine(indent, "Custom Scale", pVport.CustomScale); |
2821 |
writeLine(indent, "Elevation", pVport.Elevation); |
2822 |
writeLine(indent, "Front Clip at Eye", pVport.FrontClipAtEyeOn); |
2823 |
writeLine(indent, "Front Clip Distance", pVport.FrontClipDistance); |
2824 |
writeLine(indent, "Front Clip On", pVport.FrontClipOn); |
2825 |
writeLine(indent, "Plot style sheet", pVport.EffectivePlotStyleSheet); |
2826 |
|
2827 |
ObjectIdCollection layerIds = pVport.GetFrozenLayers(); |
2828 |
if (layerIds.Count > 0) |
2829 |
{ |
2830 |
writeLine(indent, "Frozen Layers:"); |
2831 |
for (int i = 0; i < layerIds.Count; i++) |
2832 |
{ |
2833 |
writeLine(indent + 1, i, layerIds[i]); |
2834 |
} |
2835 |
} |
2836 |
else |
2837 |
{ |
2838 |
writeLine(indent, "Frozen Layers", "None"); |
2839 |
} |
2840 |
|
2841 |
Point3d origin = new Point3d(); |
2842 |
Vector3d xAxis = new Vector3d(); |
2843 |
Vector3d yAxis = new Vector3d(); |
2844 |
pVport.GetUcs(ref origin, ref xAxis, ref yAxis); |
2845 |
writeLine(indent, "UCS origin", origin); |
2846 |
writeLine(indent, "UCS x-Axis", xAxis); |
2847 |
writeLine(indent, "UCS y-Axis", yAxis); |
2848 |
writeLine(indent, "Grid Increment", pVport.GridIncrement); |
2849 |
writeLine(indent, "Grid On", pVport.GridOn); |
2850 |
writeLine(indent, "Height", pVport.Height); |
2851 |
writeLine(indent, "Lens Length", pVport.LensLength); |
2852 |
writeLine(indent, "Locked", pVport.Locked); |
2853 |
writeLine(indent, "Non-Rectangular Clip", pVport.NonRectClipOn); |
2854 |
|
2855 |
if (!pVport.NonRectClipEntityId.IsNull) |
2856 |
{ |
2857 |
writeLine(indent, "Non-rectangular Clipper", pVport.NonRectClipEntityId.Handle); |
2858 |
} |
2859 |
writeLine(indent, "Render Mode", pVport.RenderMode); |
2860 |
writeLine(indent, "Remove Hidden Lines", pVport.HiddenLinesRemoved); |
2861 |
writeLine(indent, "Shade Plot", pVport.ShadePlot); |
2862 |
writeLine(indent, "Snap Isometric", pVport.SnapIsometric); |
2863 |
writeLine(indent, "Snap On", pVport.SnapOn); |
2864 |
writeLine(indent, "Transparent", pVport.Transparent); |
2865 |
writeLine(indent, "UCS Follow", pVport.UcsFollowModeOn); |
2866 |
writeLine(indent, "UCS Icon at Origin", pVport.UcsIconAtOrigin); |
2867 |
|
2868 |
writeLine(indent, "UCS Orthographic", pVport.UcsOrthographic); |
2869 |
writeLine(indent, "UCS Saved with VP", pVport.UcsPerViewport); |
2870 |
|
2871 |
if (!pVport.UcsName.IsNull) |
2872 |
{ |
2873 |
using (UcsTableRecord pUCS = (UcsTableRecord)pVport.UcsName.Open(OpenMode.ForRead)) |
2874 |
writeLine(indent, "UCS Name", pUCS.Name); |
2875 |
} |
2876 |
else |
2877 |
{ |
2878 |
writeLine(indent, "UCS Name", "Null"); |
2879 |
} |
2880 |
|
2881 |
writeLine(indent, "View Center", pVport.ViewCenter); |
2882 |
writeLine(indent, "View Height", pVport.ViewHeight); |
2883 |
writeLine(indent, "View Target", pVport.ViewTarget); |
2884 |
writeLine(indent, "Width", pVport.Width); |
2885 |
dumpEntityData(pVport, indent, Program.xml.DocumentElement); |
2886 |
|
2887 |
{ |
2888 |
using (DBObjectCollection collection = new DBObjectCollection()) |
2889 |
{ |
2890 |
try |
2891 |
{ |
2892 |
pVport.ExplodeGeometry(collection); |
2893 |
|
2894 |
foreach (Entity ent in collection) |
2895 |
{ |
2896 |
if (ent is Polyline2d) |
2897 |
{ |
2898 |
Polyline2d pline2d = (Polyline2d)ent; |
2899 |
int i = 0; |
2900 |
foreach (Entity ent1 in pline2d) |
2901 |
{ |
2902 |
if (ent1 is Vertex2d) |
2903 |
{ |
2904 |
Vertex2d vtx2d = (Vertex2d)ent1; |
2905 |
dump2dVertex(indent, vtx2d, i++, VportNode); |
2906 |
} |
2907 |
} |
2908 |
} |
2909 |
} |
2910 |
} |
2911 |
catch (System.Exception) |
2912 |
{ |
2913 |
} |
2914 |
} |
2915 |
} |
2916 |
|
2917 |
node.AppendChild(VportNode); |
2918 |
return VportNode; |
2919 |
} |
2920 |
|
2921 |
return null; |
2922 |
} |
2923 |
|
2924 |
/************************************************************************/ |
2925 |
/* Wipeout Dumper */ |
2926 |
/************************************************************************/ |
2927 |
void dump(Wipeout pWipeout, int indent) |
2928 |
{ |
2929 |
writeLine(indent++, pWipeout.GetRXClass().Name, pWipeout.Handle); |
2930 |
dumpRasterImageData(pWipeout, indent); |
2931 |
} |
2932 |
|
2933 |
/************************************************************************/ |
2934 |
/* Xline Dumper */ |
2935 |
/************************************************************************/ |
2936 |
void dump(Xline pXline, int indent) |
2937 |
{ |
2938 |
writeLine(indent++, pXline.GetRXClass().Name, pXline.Handle); |
2939 |
writeLine(indent, "Base Point", pXline.BasePoint); |
2940 |
writeLine(indent, "Unit Direction", pXline.UnitDir); |
2941 |
dumpCurveData(pXline, indent, Program.xml.DocumentElement); |
2942 |
} |
2943 |
|
2944 |
public void dump(Database pDb, int indent, XmlNode node) |
2945 |
{ |
2946 |
using (BlockTableRecord btr = (BlockTableRecord)pDb.CurrentSpaceId.GetObject(OpenMode.ForRead)) |
2947 |
{ |
2948 |
using (Layout pLayout = (Layout)btr.LayoutId.GetObject(OpenMode.ForRead)) |
2949 |
{ |
2950 |
string layoutName = ""; |
2951 |
layoutName = pLayout.LayoutName; |
2952 |
|
2953 |
XmlAttribute LayoutNameAttr = Program.xml.CreateAttribute("LayoutName"); |
2954 |
LayoutNameAttr.Value = layoutName; |
2955 |
node.Attributes.SetNamedItem(LayoutNameAttr); |
2956 |
} |
2957 |
} |
2958 |
|
2959 |
dumpHeader(pDb, indent, node); |
2960 |
dumpLayers(pDb, indent, node); |
2961 |
dumpLinetypes(pDb, indent, node); |
2962 |
dumpTextStyles(pDb, indent, node); |
2963 |
dumpDimStyles(pDb, indent, node); |
2964 |
dumpRegApps(pDb, indent); |
2965 |
dumpViewports(pDb, indent, node); |
2966 |
dumpViews(pDb, indent, node); |
2967 |
dumpMLineStyles(pDb, indent); |
2968 |
dumpUCSTable(pDb, indent, node); |
2969 |
dumpObject(pDb.NamedObjectsDictionaryId, "Named Objects Dictionary", indent); |
2970 |
|
2971 |
dumpBlocks(pDb, indent, node); |
2972 |
} |
2973 |
|
2974 |
/************************************************************************/ |
2975 |
/* Dump the BlockTable */ |
2976 |
/************************************************************************/ |
2977 |
public void dumpBlocks(Database pDb, int indent, XmlNode node) |
2978 |
{ |
2979 |
/**********************************************************************/ |
2980 |
/* Get a pointer to the BlockTable */ |
2981 |
/**********************************************************************/ |
2982 |
using (BlockTable pTable = (BlockTable)pDb.BlockTableId.Open(OpenMode.ForRead)) |
2983 |
{ |
2984 |
/**********************************************************************/ |
2985 |
/* Dump the Description */ |
2986 |
/**********************************************************************/ |
2987 |
XmlElement BlocksNode = Program.xml.CreateElement(pTable.GetRXClass().Name); |
2988 |
|
2989 |
/**********************************************************************/ |
2990 |
/* Step through the BlockTable */ |
2991 |
/**********************************************************************/ |
2992 |
foreach (ObjectId id in pTable) |
2993 |
{ |
2994 |
/********************************************************************/ |
2995 |
/* Open the BlockTableRecord for Reading */ |
2996 |
/********************************************************************/ |
2997 |
using (BlockTableRecord pBlock = (BlockTableRecord)id.Open(OpenMode.ForRead)) |
2998 |
{ |
2999 |
/********************************************************************/ |
3000 |
/* Dump the BlockTableRecord */ |
3001 |
/********************************************************************/ |
3002 |
XmlElement BlockNode = Program.xml.CreateElement(pBlock.GetRXClass().Name); |
3003 |
|
3004 |
XmlAttribute NameAttr = Program.xml.CreateAttribute("Name"); |
3005 |
NameAttr.Value = pBlock.Name; |
3006 |
BlockNode.Attributes.SetNamedItem(NameAttr); |
3007 |
|
3008 |
XmlAttribute CommentsAttr = Program.xml.CreateAttribute("Comments"); |
3009 |
CommentsAttr.Value = pBlock.Comments; |
3010 |
BlockNode.Attributes.SetNamedItem(CommentsAttr); |
3011 |
|
3012 |
XmlAttribute OriginAttr = Program.xml.CreateAttribute("Origin"); |
3013 |
OriginAttr.Value = pBlock.Origin.ToString(); |
3014 |
BlockNode.Attributes.SetNamedItem(OriginAttr); |
3015 |
|
3016 |
writeLine(indent, pBlock.GetRXClass().Name); |
3017 |
writeLine(indent + 1, "Anonymous", pBlock.IsAnonymous); |
3018 |
writeLine(indent + 1, "Block Insert Units", pBlock.Units); |
3019 |
writeLine(indent + 1, "Block Scaling", pBlock.BlockScaling); |
3020 |
writeLine(indent + 1, "Explodable", pBlock.Explodable); |
3021 |
writeLine(indent + 1, "IsDynamicBlock", pBlock.IsDynamicBlock); |
3022 |
|
3023 |
try |
3024 |
{ |
3025 |
Extents3d extents = new Extents3d(new Point3d(1E+20, 1E+20, 1E+20), new Point3d(1E-20, 1E-20, 1E-20)); |
3026 |
extents.AddBlockExtents(pBlock); |
3027 |
|
3028 |
XmlAttribute MinExtentsAttr = Program.xml.CreateAttribute("MinExtents"); |
3029 |
MinExtentsAttr.Value = extents.MinPoint.ToString(); |
3030 |
BlockNode.Attributes.SetNamedItem(MinExtentsAttr); |
3031 |
|
3032 |
XmlAttribute MaxExtentsAttr = Program.xml.CreateAttribute("MaxExtents"); |
3033 |
MaxExtentsAttr.Value = extents.MaxPoint.ToString(); |
3034 |
BlockNode.Attributes.SetNamedItem(MaxExtentsAttr); |
3035 |
} |
3036 |
catch (System.Exception) |
3037 |
{ |
3038 |
} |
3039 |
|
3040 |
writeLine(indent + 1, "Layout", pBlock.IsLayout); |
3041 |
writeLine(indent + 1, "Has Attribute Definitions", pBlock.HasAttributeDefinitions); |
3042 |
writeLine(indent + 1, "Xref Status", pBlock.XrefStatus); |
3043 |
if (pBlock.XrefStatus != XrefStatus.NotAnXref) |
3044 |
{ |
3045 |
writeLine(indent + 1, "Xref Path", pBlock.PathName); |
3046 |
writeLine(indent + 1, "From Xref Attach", pBlock.IsFromExternalReference); |
3047 |
writeLine(indent + 1, "From Xref Overlay", pBlock.IsFromOverlayReference); |
3048 |
writeLine(indent + 1, "Xref Unloaded", pBlock.IsUnloaded); |
3049 |
} |
3050 |
|
3051 |
/********************************************************************/ |
3052 |
/* Step through the BlockTableRecord */ |
3053 |
/********************************************************************/ |
3054 |
foreach (ObjectId entid in pBlock) |
3055 |
{ |
3056 |
/********************************************************************/ |
3057 |
/* Dump the Entity */ |
3058 |
/********************************************************************/ |
3059 |
dumpEntity(entid, indent + 1, BlockNode); |
3060 |
} |
3061 |
|
3062 |
BlocksNode.AppendChild(BlockNode); |
3063 |
} |
3064 |
} |
3065 |
|
3066 |
node.AppendChild(BlocksNode); |
3067 |
} |
3068 |
} |
3069 |
|
3070 |
public void dumpDimStyles(Database pDb, int indent, XmlNode node) |
3071 |
{ |
3072 |
/**********************************************************************/ |
3073 |
/* Get a SmartPointer to the DimStyleTable */ |
3074 |
/**********************************************************************/ |
3075 |
using (DimStyleTable pTable = (DimStyleTable)pDb.DimStyleTableId.Open(OpenMode.ForRead)) |
3076 |
{ |
3077 |
/**********************************************************************/ |
3078 |
/* Dump the Description */ |
3079 |
/**********************************************************************/ |
3080 |
writeLine(); |
3081 |
writeLine(indent++, pTable.GetRXClass().Name); |
3082 |
|
3083 |
/**********************************************************************/ |
3084 |
/* Step through the DimStyleTable */ |
3085 |
/**********************************************************************/ |
3086 |
foreach (ObjectId id in pTable) |
3087 |
{ |
3088 |
/*********************************************************************/ |
3089 |
/* Open the DimStyleTableRecord for Reading */ |
3090 |
/*********************************************************************/ |
3091 |
using (DimStyleTableRecord pRecord = (DimStyleTableRecord)id.Open(OpenMode.ForRead)) |
3092 |
{ |
3093 |
/*********************************************************************/ |
3094 |
/* Dump the DimStyleTableRecord */ |
3095 |
/*********************************************************************/ |
3096 |
writeLine(); |
3097 |
writeLine(indent, pRecord.GetRXClass().Name); |
3098 |
writeLine(indent, "Name", pRecord.Name); |
3099 |
writeLine(indent, "Arc Symbol", toArcSymbolTypeString(pRecord.Dimarcsym)); |
3100 |
|
3101 |
writeLine(indent, "Background Text Color", pRecord.Dimtfillclr); |
3102 |
writeLine(indent, "BackgroundText Flags", pRecord.Dimtfill); |
3103 |
writeLine(indent, "Extension Line 1 Linetype", pRecord.Dimltex1); |
3104 |
writeLine(indent, "Extension Line 2 Linetype", pRecord.Dimltex2); |
3105 |
writeLine(indent, "Dimension Line Linetype", pRecord.Dimltype); |
3106 |
writeLine(indent, "Extension Line Fixed Len", pRecord.Dimfxlen); |
3107 |
writeLine(indent, "Extension Line Fixed Len Enable", pRecord.DimfxlenOn); |
3108 |
writeLine(indent, "Jog Angle", toDegreeString(pRecord.Dimjogang)); |
3109 |
writeLine(indent, "Modified For Recompute", pRecord.IsModifiedForRecompute); |
3110 |
writeLine(indent, "DIMADEC", pRecord.Dimadec); |
3111 |
writeLine(indent, "DIMALT", pRecord.Dimalt); |
3112 |
writeLine(indent, "DIMALTD", pRecord.Dimaltd); |
3113 |
writeLine(indent, "DIMALTF", pRecord.Dimaltf); |
3114 |
writeLine(indent, "DIMALTRND", pRecord.Dimaltrnd); |
3115 |
writeLine(indent, "DIMALTTD", pRecord.Dimalttd); |
3116 |
writeLine(indent, "DIMALTTZ", pRecord.Dimalttz); |
3117 |
writeLine(indent, "DIMALTU", pRecord.Dimaltu); |
3118 |
writeLine(indent, "DIMALTZ", pRecord.Dimaltz); |
3119 |
writeLine(indent, "DIMAPOST", pRecord.Dimapost); |
3120 |
writeLine(indent, "DIMASZ", pRecord.Dimasz); |
3121 |
writeLine(indent, "DIMATFIT", pRecord.Dimatfit); |
3122 |
writeLine(indent, "DIMAUNIT", pRecord.Dimaunit); |
3123 |
writeLine(indent, "DIMAZIN", pRecord.Dimazin); |
3124 |
writeLine(indent, "DIMBLK", pRecord.Dimblk); |
3125 |
writeLine(indent, "DIMBLK1", pRecord.Dimblk1); |
3126 |
writeLine(indent, "DIMBLK2", pRecord.Dimblk2); |
3127 |
writeLine(indent, "DIMCEN", pRecord.Dimcen); |
3128 |
writeLine(indent, "DIMCLRD", pRecord.Dimclrd); |
3129 |
writeLine(indent, "DIMCLRE", pRecord.Dimclre); |
3130 |
writeLine(indent, "DIMCLRT", pRecord.Dimclrt); |
3131 |
writeLine(indent, "DIMDEC", pRecord.Dimdec); |
3132 |
writeLine(indent, "DIMDLE", pRecord.Dimdle); |
3133 |
writeLine(indent, "DIMDLI", pRecord.Dimdli); |
3134 |
writeLine(indent, "DIMDSEP", pRecord.Dimdsep); |
3135 |
writeLine(indent, "DIMEXE", pRecord.Dimexe); |
3136 |
writeLine(indent, "DIMEXO", pRecord.Dimexo); |
3137 |
writeLine(indent, "DIMFRAC", pRecord.Dimfrac); |
3138 |
writeLine(indent, "DIMGAP", pRecord.Dimgap); |
3139 |
writeLine(indent, "DIMJUST", pRecord.Dimjust); |
3140 |
writeLine(indent, "DIMLDRBLK", pRecord.Dimldrblk); |
3141 |
writeLine(indent, "DIMLFAC", pRecord.Dimlfac); |
3142 |
writeLine(indent, "DIMLIM", pRecord.Dimlim); |
3143 |
writeLine(indent, "DIMLUNIT", pRecord.Dimlunit); |
3144 |
writeLine(indent, "DIMLWD", pRecord.Dimlwd); |
3145 |
writeLine(indent, "DIMLWE", pRecord.Dimlwe); |
3146 |
writeLine(indent, "DIMPOST", pRecord.Dimpost); |
3147 |
writeLine(indent, "DIMRND", pRecord.Dimrnd); |
3148 |
writeLine(indent, "DIMSAH", pRecord.Dimsah); |
3149 |
writeLine(indent, "DIMSCALE", pRecord.Dimscale); |
3150 |
writeLine(indent, "DIMSD1", pRecord.Dimsd1); |
3151 |
writeLine(indent, "DIMSD2", pRecord.Dimsd2); |
3152 |
writeLine(indent, "DIMSE1", pRecord.Dimse1); |
3153 |
writeLine(indent, "DIMSE2", pRecord.Dimse2); |
3154 |
writeLine(indent, "DIMSOXD", pRecord.Dimsoxd); |
3155 |
writeLine(indent, "DIMTAD", pRecord.Dimtad); |
3156 |
writeLine(indent, "DIMTDEC", pRecord.Dimtdec); |
3157 |
writeLine(indent, "DIMTFAC", pRecord.Dimtfac); |
3158 |
writeLine(indent, "DIMTIH", pRecord.Dimtih); |
3159 |
writeLine(indent, "DIMTIX", pRecord.Dimtix); |
3160 |
writeLine(indent, "DIMTM", pRecord.Dimtm); |
3161 |
writeLine(indent, "DIMTOFL", pRecord.Dimtofl); |
3162 |
writeLine(indent, "DIMTOH", pRecord.Dimtoh); |
3163 |
writeLine(indent, "DIMTOL", pRecord.Dimtol); |
3164 |
writeLine(indent, "DIMTOLJ", pRecord.Dimtolj); |
3165 |
writeLine(indent, "DIMTP", pRecord.Dimtp); |
3166 |
writeLine(indent, "DIMTSZ", pRecord.Dimtsz); |
3167 |
writeLine(indent, "DIMTVP", pRecord.Dimtvp); |
3168 |
writeLine(indent, "DIMTXSTY", pRecord.Dimtxsty); |
3169 |
writeLine(indent, "DIMTXT", pRecord.Dimtxt); |
3170 |
writeLine(indent, "DIMTZIN", pRecord.Dimtzin); |
3171 |
writeLine(indent, "DIMUPT", pRecord.Dimupt); |
3172 |
writeLine(indent, "DIMZIN", pRecord.Dimzin); |
3173 |
|
3174 |
dumpSymbolTableRecord(pRecord, indent, node); |
3175 |
} |
3176 |
} |
3177 |
} |
3178 |
} |
3179 |
|
3180 |
/// <summary> |
3181 |
/// extract information from entity has given id |
3182 |
/// </summary> |
3183 |
/// <param name="id"></param> |
3184 |
/// <param name="indent"></param> |
3185 |
/// <param name="node">XmlNode</param> |
3186 |
public void dumpEntity(ObjectId id, int indent, XmlNode node) |
3187 |
{ |
3188 |
/**********************************************************************/ |
3189 |
/* Get a pointer to the Entity */ |
3190 |
/**********************************************************************/ |
3191 |
try |
3192 |
{ |
3193 |
using (Entity pEnt = (Entity)id.Open(OpenMode.ForRead, false, true)) |
3194 |
{ |
3195 |
/**********************************************************************/ |
3196 |
/* Dump the entity */ |
3197 |
/**********************************************************************/ |
3198 |
writeLine(); |
3199 |
// Protocol extensions are not supported in DD.NET (as well as in ARX.NET) |
3200 |
// so we just switch by entity type here |
3201 |
// (maybe it makes sense to make a map: type -> delegate) |
3202 |
switch (pEnt.GetRXClass().Name) |
3203 |
{ |
3204 |
case "AcDbAlignedDimension": |
3205 |
dump((AlignedDimension)pEnt, indent, node); |
3206 |
break; |
3207 |
case "AcDbArc": |
3208 |
dump((Arc)pEnt, indent, node); |
3209 |
break; |
3210 |
case "AcDbArcDimension": |
3211 |
dump((ArcDimension)pEnt, indent, node); |
3212 |
break; |
3213 |
case "AcDbBlockReference": |
3214 |
dump((BlockReference)pEnt, indent, node); |
3215 |
break; |
3216 |
case "AcDbBody": |
3217 |
dump((Body)pEnt, indent, node); |
3218 |
break; |
3219 |
case "AcDbCircle": |
3220 |
dump((Circle)pEnt, indent, node); |
3221 |
break; |
3222 |
case "AcDbPoint": |
3223 |
dump((DBPoint)pEnt, indent); |
3224 |
break; |
3225 |
case "AcDbText": |
3226 |
dump((DBText)pEnt, indent, node); |
3227 |
break; |
3228 |
case "AcDbDiametricDimension": |
3229 |
dump((DiametricDimension)pEnt, indent, node); |
3230 |
break; |
3231 |
case "AcDbViewport": |
3232 |
dump((Teigha.DatabaseServices.Viewport)pEnt, indent, node); |
3233 |
break; |
3234 |
case "AcDbEllipse": |
3235 |
dump((Ellipse)pEnt, indent, node); |
3236 |
break; |
3237 |
case "AcDbFace": |
3238 |
dump((Face)pEnt, indent, node); |
3239 |
break; |
3240 |
case "AcDbFcf": |
3241 |
dump((FeatureControlFrame)pEnt, indent); |
3242 |
break; |
3243 |
case "AcDbHatch": |
3244 |
dump((Hatch)pEnt, indent); |
3245 |
break; |
3246 |
case "AcDbLeader": |
3247 |
dump((Leader)pEnt, indent); |
3248 |
break; |
3249 |
case "AcDbLine": |
3250 |
dump((Line)pEnt, indent, node); |
3251 |
break; |
3252 |
case "AcDb2LineAngularDimension": |
3253 |
dump((LineAngularDimension2)pEnt, indent, node); |
3254 |
break; |
3255 |
case "AcDbMInsertBlock": |
3256 |
dump((MInsertBlock)pEnt, indent, node); |
3257 |
break; |
3258 |
case "AcDbMline": |
3259 |
dump((Mline)pEnt, indent); |
3260 |
break; |
3261 |
case "AcDbMText": |
3262 |
dump((MText)pEnt, indent, node); |
3263 |
break; |
3264 |
case "AcDbOle2Frame": |
3265 |
dump((Ole2Frame)pEnt, indent); |
3266 |
break; |
3267 |
case "AcDbOrdinateDimension": |
3268 |
dump((OrdinateDimension)pEnt, indent, node); |
3269 |
break; |
3270 |
case "AcDb3PointAngularDimension": |
3271 |
dump((Point3AngularDimension)pEnt, indent, node); |
3272 |
break; |
3273 |
case "AcDbPolyFaceMesh": |
3274 |
dump((PolyFaceMesh)pEnt, indent, node); |
3275 |
break; |
3276 |
case "AcDbPolygonMesh": |
3277 |
dump((PolygonMesh)pEnt, indent); |
3278 |
break; |
3279 |
case "AcDbPolyline": |
3280 |
dump((Teigha.DatabaseServices.Polyline)pEnt, indent, node); |
3281 |
break; |
3282 |
case "AcDb2dPolyline": |
3283 |
dump((Polyline2d)pEnt, indent, node); |
3284 |
break; |
3285 |
case "AcDb3dPolyline": |
3286 |
dump((Polyline3d)pEnt, indent, node); |
3287 |
break; |
3288 |
case "AcDbProxyEntity": |
3289 |
dump((ProxyEntity)pEnt, indent, node); |
3290 |
break; |
3291 |
case "AcDbRadialDimension": |
3292 |
dump((RadialDimension)pEnt, indent, node); |
3293 |
break; |
3294 |
case "AcDbRasterImage": |
3295 |
dump((RasterImage)pEnt, indent); |
3296 |
break; |
3297 |
case "AcDbRay": |
3298 |
dump((Ray)pEnt, indent); |
3299 |
break; |
3300 |
case "AcDbRegion": |
3301 |
dump((Region)pEnt, indent); |
3302 |
break; |
3303 |
case "AcDbRotatedDimension": |
3304 |
dump((RotatedDimension)pEnt, indent, node); |
3305 |
break; |
3306 |
case "AcDbShape": |
3307 |
dump((Shape)pEnt, indent); |
3308 |
break; |
3309 |
case "AcDb3dSolid": |
3310 |
dump((Solid3d)pEnt, indent, node); |
3311 |
break; |
3312 |
case "AcDbSpline": |
3313 |
dump((Spline)pEnt, indent); |
3314 |
break; |
3315 |
case "AcDbTable": |
3316 |
dump((Table)pEnt, indent); |
3317 |
break; |
3318 |
case "AcDbTrace": |
3319 |
dump((Trace)pEnt, indent); |
3320 |
break; |
3321 |
case "AcDbWipeout": |
3322 |
dump((Wipeout)pEnt, indent); |
3323 |
break; |
3324 |
case "AcDbXline": |
3325 |
dump((Xline)pEnt, indent); |
3326 |
break; |
3327 |
case "AcDbPdfReference": |
3328 |
case "AcDbDwfReference": |
3329 |
case "AcDbDgnReference": |
3330 |
dump((UnderlayReference)pEnt, indent); |
3331 |
break; |
3332 |
default: |
3333 |
dump(pEnt, indent, node); |
3334 |
break; |
3335 |
} |
3336 |
/* Dump the Xdata */ |
3337 |
/**********************************************************************/ |
3338 |
dumpXdata(pEnt.XData, indent); |
3339 |
|
3340 |
/**********************************************************************/ |
3341 |
/* Dump the Extension Dictionary */ |
3342 |
/**********************************************************************/ |
3343 |
if (!pEnt.ExtensionDictionary.IsNull) |
3344 |
{ |
3345 |
dumpObject(pEnt.ExtensionDictionary, "ACAD_XDICTIONARY", indent); |
3346 |
} |
3347 |
} |
3348 |
} |
3349 |
catch(Exception ex) |
3350 |
{ |
3351 |
writeLine(indent, $"OID = {id.ToString()}, Error = {ex.Message}"); |
3352 |
} |
3353 |
} |
3354 |
public void dumpHeader(Database pDb, int indent, XmlNode node) |
3355 |
{ |
3356 |
if (node != null) |
3357 |
{ |
3358 |
XmlAttribute FileNameAttr = Program.xml.CreateAttribute("FileName"); |
3359 |
FileNameAttr.Value = shortenPath(pDb.Filename); |
3360 |
node.Attributes.SetNamedItem(FileNameAttr); |
3361 |
|
3362 |
XmlAttribute OriginalFileVersionAttr = Program.xml.CreateAttribute("OriginalFileVersion"); |
3363 |
OriginalFileVersionAttr.Value = pDb.OriginalFileVersion.ToString(); |
3364 |
node.Attributes.SetNamedItem(OriginalFileVersionAttr); |
3365 |
|
3366 |
writeLine(); |
3367 |
writeLine(indent++, "Header Variables:"); |
3368 |
|
3369 |
//writeLine(); |
3370 |
//writeLine(indent, "TDCREATE:", pDb.TDCREATE); |
3371 |
//writeLine(indent, "TDUPDATE:", pDb.TDUPDATE); |
3372 |
|
3373 |
writeLine(); |
3374 |
writeLine(indent, "ANGBASE", pDb.Angbase); |
3375 |
writeLine(indent, "ANGDIR", pDb.Angdir); |
3376 |
writeLine(indent, "ATTMODE", pDb.Attmode); |
3377 |
writeLine(indent, "AUNITS", pDb.Aunits); |
3378 |
writeLine(indent, "AUPREC", pDb.Auprec); |
3379 |
writeLine(indent, "CECOLOR", pDb.Cecolor); |
3380 |
writeLine(indent, "CELTSCALE", pDb.Celtscale); |
3381 |
writeLine(indent, "CHAMFERA", pDb.Chamfera); |
3382 |
writeLine(indent, "CHAMFERB", pDb.Chamferb); |
3383 |
writeLine(indent, "CHAMFERC", pDb.Chamferc); |
3384 |
writeLine(indent, "CHAMFERD", pDb.Chamferd); |
3385 |
writeLine(indent, "CMLJUST", pDb.Cmljust); |
3386 |
writeLine(indent, "CMLSCALE", pDb.Cmljust); |
3387 |
writeLine(indent, "DIMADEC", pDb.Dimadec); |
3388 |
writeLine(indent, "DIMALT", pDb.Dimalt); |
3389 |
writeLine(indent, "DIMALTD", pDb.Dimaltd); |
3390 |
writeLine(indent, "DIMALTF", pDb.Dimaltf); |
3391 |
writeLine(indent, "DIMALTRND", pDb.Dimaltrnd); |
3392 |
writeLine(indent, "DIMALTTD", pDb.Dimalttd); |
3393 |
writeLine(indent, "DIMALTTZ", pDb.Dimalttz); |
3394 |
writeLine(indent, "DIMALTU", pDb.Dimaltu); |
3395 |
writeLine(indent, "DIMALTZ", pDb.Dimaltz); |
3396 |
writeLine(indent, "DIMAPOST", pDb.Dimapost); |
3397 |
writeLine(indent, "DIMASZ", pDb.Dimasz); |
3398 |
writeLine(indent, "DIMATFIT", pDb.Dimatfit); |
3399 |
writeLine(indent, "DIMAUNIT", pDb.Dimaunit); |
3400 |
writeLine(indent, "DIMAZIN", pDb.Dimazin); |
3401 |
writeLine(indent, "DIMBLK", pDb.Dimblk); |
3402 |
writeLine(indent, "DIMBLK1", pDb.Dimblk1); |
3403 |
writeLine(indent, "DIMBLK2", pDb.Dimblk2); |
3404 |
writeLine(indent, "DIMCEN", pDb.Dimcen); |
3405 |
writeLine(indent, "DIMCLRD", pDb.Dimclrd); |
3406 |
writeLine(indent, "DIMCLRE", pDb.Dimclre); |
3407 |
writeLine(indent, "DIMCLRT", pDb.Dimclrt); |
3408 |
writeLine(indent, "DIMDEC", pDb.Dimdec); |
3409 |
writeLine(indent, "DIMDLE", pDb.Dimdle); |
3410 |
writeLine(indent, "DIMDLI", pDb.Dimdli); |
3411 |
writeLine(indent, "DIMDSEP", pDb.Dimdsep); |
3412 |
writeLine(indent, "DIMEXE", pDb.Dimexe); |
3413 |
writeLine(indent, "DIMEXO", pDb.Dimexo); |
3414 |
writeLine(indent, "DIMFRAC", pDb.Dimfrac); |
3415 |
writeLine(indent, "DIMGAP", pDb.Dimgap); |
3416 |
writeLine(indent, "DIMJUST", pDb.Dimjust); |
3417 |
writeLine(indent, "DIMLDRBLK", pDb.Dimldrblk); |
3418 |
writeLine(indent, "DIMLFAC", pDb.Dimlfac); |
3419 |
writeLine(indent, "DIMLIM", pDb.Dimlim); |
3420 |
writeLine(indent, "DIMLUNIT", pDb.Dimlunit); |
3421 |
writeLine(indent, "DIMLWD", pDb.Dimlwd); |
3422 |
writeLine(indent, "DIMLWE", pDb.Dimlwe); |
3423 |
writeLine(indent, "DIMPOST", pDb.Dimpost); |
3424 |
writeLine(indent, "DIMRND", pDb.Dimrnd); |
3425 |
writeLine(indent, "DIMSAH", pDb.Dimsah); |
3426 |
writeLine(indent, "DIMSCALE", pDb.Dimscale); |
3427 |
writeLine(indent, "DIMSD1", pDb.Dimsd1); |
3428 |
writeLine(indent, "DIMSD2", pDb.Dimsd2); |
3429 |
writeLine(indent, "DIMSE1", pDb.Dimse1); |
3430 |
writeLine(indent, "DIMSE2", pDb.Dimse2); |
3431 |
writeLine(indent, "DIMSOXD", pDb.Dimsoxd); |
3432 |
writeLine(indent, "DIMTAD", pDb.Dimtad); |
3433 |
writeLine(indent, "DIMTDEC", pDb.Dimtdec); |
3434 |
writeLine(indent, "DIMTFAC", pDb.Dimtfac); |
3435 |
writeLine(indent, "DIMTIH", pDb.Dimtih); |
3436 |
writeLine(indent, "DIMTIX", pDb.Dimtix); |
3437 |
writeLine(indent, "DIMTM", pDb.Dimtm); |
3438 |
writeLine(indent, "DIMTOFL", pDb.Dimtofl); |
3439 |
writeLine(indent, "DIMTOH", pDb.Dimtoh); |
3440 |
writeLine(indent, "DIMTOL", pDb.Dimtol); |
3441 |
writeLine(indent, "DIMTOLJ", pDb.Dimtolj); |
3442 |
writeLine(indent, "DIMTP", pDb.Dimtp); |
3443 |
writeLine(indent, "DIMTSZ", pDb.Dimtsz); |
3444 |
writeLine(indent, "DIMTVP", pDb.Dimtvp); |
3445 |
writeLine(indent, "DIMTXSTY", pDb.Dimtxsty); |
3446 |
writeLine(indent, "DIMTXT", pDb.Dimtxt); |
3447 |
writeLine(indent, "DIMTZIN", pDb.Dimtzin); |
3448 |
writeLine(indent, "DIMUPT", pDb.Dimupt); |
3449 |
writeLine(indent, "DIMZIN", pDb.Dimzin); |
3450 |
writeLine(indent, "DISPSILH", pDb.DispSilh); |
3451 |
writeLine(indent, "DRAWORDERCTL", pDb.DrawOrderCtl); |
3452 |
writeLine(indent, "ELEVATION", pDb.Elevation); |
3453 |
writeLine(indent, "EXTMAX", pDb.Extmax); |
3454 |
writeLine(indent, "EXTMIN", pDb.Extmin); |
3455 |
writeLine(indent, "FACETRES", pDb.Facetres); |
3456 |
writeLine(indent, "FILLETRAD", pDb.Filletrad); |
3457 |
writeLine(indent, "FILLMODE", pDb.Fillmode); |
3458 |
writeLine(indent, "INSBASE", pDb.Insbase); |
3459 |
writeLine(indent, "ISOLINES", pDb.Isolines); |
3460 |
writeLine(indent, "LIMCHECK", pDb.Limcheck); |
3461 |
writeLine(indent, "LIMMAX", pDb.Limmax); |
3462 |
writeLine(indent, "LIMMIN", pDb.Limmin); |
3463 |
writeLine(indent, "LTSCALE", pDb.Ltscale); |
3464 |
writeLine(indent, "LUNITS", pDb.Lunits); |
3465 |
writeLine(indent, "LUPREC", pDb.Luprec); |
3466 |
writeLine(indent, "MAXACTVP", pDb.Maxactvp); |
3467 |
writeLine(indent, "MIRRTEXT", pDb.Mirrtext); |
3468 |
writeLine(indent, "ORTHOMODE", pDb.Orthomode); |
3469 |
writeLine(indent, "PDMODE", pDb.Pdmode); |
3470 |
writeLine(indent, "PDSIZE", pDb.Pdsize); |
3471 |
writeLine(indent, "PELEVATION", pDb.Pelevation); |
3472 |
writeLine(indent, "PELLIPSE", pDb.PlineEllipse); |
3473 |
writeLine(indent, "PEXTMAX", pDb.Pextmax); |
3474 |
writeLine(indent, "PEXTMIN", pDb.Pextmin); |
3475 |
writeLine(indent, "PINSBASE", pDb.Pinsbase); |
3476 |
writeLine(indent, "PLIMCHECK", pDb.Plimcheck); |
3477 |
writeLine(indent, "PLIMMAX", pDb.Plimmax); |
3478 |
writeLine(indent, "PLIMMIN", pDb.Plimmin); |
3479 |
writeLine(indent, "PLINEGEN", pDb.Plinegen); |
3480 |
writeLine(indent, "PLINEWID", pDb.Plinewid); |
3481 |
writeLine(indent, "PROXYGRAPHICS", pDb.Saveproxygraphics); |
3482 |
writeLine(indent, "PSLTSCALE", pDb.Psltscale); |
3483 |
writeLine(indent, "PUCSNAME", pDb.Pucsname); |
3484 |
writeLine(indent, "PUCSORG", pDb.Pucsorg); |
3485 |
writeLine(indent, "PUCSXDIR", pDb.Pucsxdir); |
3486 |
writeLine(indent, "PUCSYDIR", pDb.Pucsydir); |
3487 |
writeLine(indent, "QTEXTMODE", pDb.Qtextmode); |
3488 |
writeLine(indent, "REGENMODE", pDb.Regenmode); |
3489 |
writeLine(indent, "SHADEDGE", pDb.Shadedge); |
3490 |
writeLine(indent, "SHADEDIF", pDb.Shadedif); |
3491 |
writeLine(indent, "SKETCHINC", pDb.Sketchinc); |
3492 |
writeLine(indent, "SKPOLY", pDb.Skpoly); |
3493 |
writeLine(indent, "SPLFRAME", pDb.Splframe); |
3494 |
writeLine(indent, "SPLINESEGS", pDb.Splinesegs); |
3495 |
writeLine(indent, "SPLINETYPE", pDb.Splinetype); |
3496 |
writeLine(indent, "SURFTAB1", pDb.Surftab1); |
3497 |
writeLine(indent, "SURFTAB2", pDb.Surftab2); |
3498 |
writeLine(indent, "SURFTYPE", pDb.Surftype); |
3499 |
writeLine(indent, "SURFU", pDb.Surfu); |
3500 |
writeLine(indent, "SURFV", pDb.Surfv); |
3501 |
//writeLine(indent, "TEXTQLTY", pDb.TEXTQLTY); |
3502 |
writeLine(indent, "TEXTSIZE", pDb.Textsize); |
3503 |
writeLine(indent, "THICKNESS", pDb.Thickness); |
3504 |
writeLine(indent, "TILEMODE", pDb.TileMode); |
3505 |
writeLine(indent, "TRACEWID", pDb.Tracewid); |
3506 |
writeLine(indent, "TREEDEPTH", pDb.Treedepth); |
3507 |
writeLine(indent, "UCSNAME", pDb.Ucsname); |
3508 |
writeLine(indent, "UCSORG", pDb.Ucsorg); |
3509 |
writeLine(indent, "UCSXDIR", pDb.Ucsxdir); |
3510 |
writeLine(indent, "UCSYDIR", pDb.Ucsydir); |
3511 |
writeLine(indent, "UNITMODE", pDb.Unitmode); |
3512 |
writeLine(indent, "USERI1", pDb.Useri1); |
3513 |
writeLine(indent, "USERI2", pDb.Useri2); |
3514 |
writeLine(indent, "USERI3", pDb.Useri3); |
3515 |
writeLine(indent, "USERI4", pDb.Useri4); |
3516 |
writeLine(indent, "USERI5", pDb.Useri5); |
3517 |
writeLine(indent, "USERR1", pDb.Userr1); |
3518 |
writeLine(indent, "USERR2", pDb.Userr2); |
3519 |
writeLine(indent, "USERR3", pDb.Userr3); |
3520 |
writeLine(indent, "USERR4", pDb.Userr4); |
3521 |
writeLine(indent, "USERR5", pDb.Userr5); |
3522 |
writeLine(indent, "USRTIMER", pDb.Usrtimer); |
3523 |
writeLine(indent, "VISRETAIN", pDb.Visretain); |
3524 |
writeLine(indent, "WORLDVIEW", pDb.Worldview); |
3525 |
} |
3526 |
} |
3527 |
|
3528 |
public void dumpLayers(Database pDb, int indent, XmlNode node) |
3529 |
{ |
3530 |
if(node != null) |
3531 |
{ |
3532 |
/**********************************************************************/ |
3533 |
/* Get a SmartPointer to the LayerTable */ |
3534 |
/**********************************************************************/ |
3535 |
using (LayerTable pTable = (LayerTable)pDb.LayerTableId.Open(OpenMode.ForRead)) |
3536 |
{ |
3537 |
/**********************************************************************/ |
3538 |
/* Dump the Description */ |
3539 |
/**********************************************************************/ |
3540 |
XmlElement LayerNode = Program.xml.CreateElement(pTable.GetRXClass().Name); |
3541 |
|
3542 |
/**********************************************************************/ |
3543 |
/* Get a SmartPointer to a new SymbolTableIterator */ |
3544 |
/**********************************************************************/ |
3545 |
|
3546 |
/**********************************************************************/ |
3547 |
/* Step through the LayerTable */ |
3548 |
/**********************************************************************/ |
3549 |
foreach (ObjectId id in pTable) |
3550 |
{ |
3551 |
/********************************************************************/ |
3552 |
/* Open the LayerTableRecord for Reading */ |
3553 |
/********************************************************************/ |
3554 |
using (LayerTableRecord pRecord = (LayerTableRecord)id.Open(OpenMode.ForRead)) |
3555 |
{ |
3556 |
/********************************************************************/ |
3557 |
/* Dump the LayerTableRecord */ |
3558 |
/********************************************************************/ |
3559 |
XmlElement RecordNode = Program.xml.CreateElement(pRecord.GetRXClass().Name); |
3560 |
|
3561 |
XmlAttribute NameAttr = Program.xml.CreateAttribute("Name"); |
3562 |
NameAttr.Value = pRecord.Name.ToString(); |
3563 |
RecordNode.Attributes.SetNamedItem(NameAttr); |
3564 |
|
3565 |
XmlAttribute IsUsedAttr = Program.xml.CreateAttribute("IsUsed"); |
3566 |
IsUsedAttr.Value = pRecord.IsUsed.ToString(); |
3567 |
RecordNode.Attributes.SetNamedItem(IsUsedAttr); |
3568 |
|
3569 |
XmlAttribute IsOffAttr = Program.xml.CreateAttribute("IsOff"); |
3570 |
IsOffAttr.Value = pRecord.IsOff.ToString(); |
3571 |
RecordNode.Attributes.SetNamedItem(IsOffAttr); |
3572 |
|
3573 |
XmlAttribute IsFrozenAttr = Program.xml.CreateAttribute("IsFrozen"); |
3574 |
IsFrozenAttr.Value = pRecord.IsFrozen.ToString(); |
3575 |
RecordNode.Attributes.SetNamedItem(IsFrozenAttr); |
3576 |
|
3577 |
XmlAttribute IsLockedAttr = Program.xml.CreateAttribute("IsLocked"); |
3578 |
IsLockedAttr.Value = pRecord.IsLocked.ToString(); |
3579 |
RecordNode.Attributes.SetNamedItem(IsLockedAttr); |
3580 |
|
3581 |
XmlAttribute ColorAttr = Program.xml.CreateAttribute("Color"); |
3582 |
ColorAttr.Value = pRecord.Color.ToString(); |
3583 |
RecordNode.Attributes.SetNamedItem(ColorAttr); |
3584 |
|
3585 |
XmlAttribute LinetypeObjectIdAttr = Program.xml.CreateAttribute("LinetypeObjectId"); |
3586 |
LinetypeObjectIdAttr.Value = pRecord.LinetypeObjectId.ToString(); |
3587 |
RecordNode.Attributes.SetNamedItem(LinetypeObjectIdAttr); |
3588 |
|
3589 |
XmlAttribute LineWeightAttr = Program.xml.CreateAttribute("LineWeight"); |
3590 |
LineWeightAttr.Value = pRecord.LineWeight.ToString(); |
3591 |
RecordNode.Attributes.SetNamedItem(LineWeightAttr); |
3592 |
|
3593 |
XmlAttribute PlotStyleNameAttr = Program.xml.CreateAttribute("PlotStyleName"); |
3594 |
PlotStyleNameAttr.Value = pRecord.PlotStyleName.ToString(); |
3595 |
RecordNode.Attributes.SetNamedItem(PlotStyleNameAttr); |
3596 |
|
3597 |
XmlAttribute IsPlottableAttr = Program.xml.CreateAttribute("IsPlottable"); |
3598 |
IsPlottableAttr.Value = pRecord.IsPlottable.ToString(); |
3599 |
RecordNode.Attributes.SetNamedItem(IsPlottableAttr); |
3600 |
|
3601 |
XmlAttribute ViewportVisibilityDefaultAttr = Program.xml.CreateAttribute("ViewportVisibilityDefault"); |
3602 |
ViewportVisibilityDefaultAttr.Value = pRecord.ViewportVisibilityDefault.ToString(); |
3603 |
RecordNode.Attributes.SetNamedItem(ViewportVisibilityDefaultAttr); |
3604 |
|
3605 |
dumpSymbolTableRecord(pRecord, indent, RecordNode); |
3606 |
LayerNode.AppendChild(RecordNode); |
3607 |
} |
3608 |
} |
3609 |
|
3610 |
node.AppendChild(LayerNode); |
3611 |
} |
3612 |
} |
3613 |
} |
3614 |
|
3615 |
public void dumpLinetypes(Database pDb, int indent, XmlNode node) |
3616 |
{ |
3617 |
if (node != null) |
3618 |
{ |
3619 |
/**********************************************************************/ |
3620 |
/* Get a pointer to the LinetypeTable */ |
3621 |
/**********************************************************************/ |
3622 |
using (LinetypeTable pTable = (LinetypeTable)pDb.LinetypeTableId.Open(OpenMode.ForRead)) |
3623 |
{ |
3624 |
XmlElement LinetypeNode = Program.xml.CreateElement(pTable.GetRXClass().Name); |
3625 |
|
3626 |
/**********************************************************************/ |
3627 |
/* Step through the LinetypeTable */ |
3628 |
/**********************************************************************/ |
3629 |
foreach (ObjectId id in pTable) |
3630 |
{ |
3631 |
/*********************************************************************/ |
3632 |
/* Open the LinetypeTableRecord for Reading */ |
3633 |
/*********************************************************************/ |
3634 |
using (LinetypeTableRecord pRecord = (LinetypeTableRecord)id.Open(OpenMode.ForRead)) |
3635 |
{ |
3636 |
XmlElement RecordNode = Program.xml.CreateElement(pRecord.GetRXClass().Name); |
3637 |
|
3638 |
XmlAttribute ObjectIdAttr = Program.xml.CreateAttribute("ObjectId"); |
3639 |
ObjectIdAttr.Value = pRecord.ObjectId.ToString(); |
3640 |
RecordNode.Attributes.SetNamedItem(ObjectIdAttr); |
3641 |
|
3642 |
XmlAttribute NameAttr = Program.xml.CreateAttribute("Name"); |
3643 |
NameAttr.Value = pRecord.Name; |
3644 |
RecordNode.Attributes.SetNamedItem(NameAttr); |
3645 |
|
3646 |
XmlAttribute CommentsAttr = Program.xml.CreateAttribute("Comments"); |
3647 |
CommentsAttr.Value = pRecord.Comments; |
3648 |
RecordNode.Attributes.SetNamedItem(CommentsAttr); |
3649 |
|
3650 |
/********************************************************************/ |
3651 |
/* Dump the first line of record as in ACAD.LIN */ |
3652 |
/********************************************************************/ |
3653 |
string buffer = "*" + pRecord.Name; |
3654 |
if (pRecord.Comments != "") |
3655 |
{ |
3656 |
buffer = buffer + "," + pRecord.Comments; |
3657 |
} |
3658 |
writeLine(indent, buffer); |
3659 |
|
3660 |
/********************************************************************/ |
3661 |
/* Dump the second line of record as in ACAD.LIN */ |
3662 |
/********************************************************************/ |
3663 |
if (pRecord.NumDashes > 0) |
3664 |
{ |
3665 |
buffer = pRecord.IsScaledToFit ? "S" : "A"; |
3666 |
for (int i = 0; i < pRecord.NumDashes; i++) |
3667 |
{ |
3668 |
buffer = buffer + "," + pRecord.DashLengthAt(i); |
3669 |
int shapeNumber = pRecord.ShapeNumberAt(i); |
3670 |
string text = pRecord.TextAt(i); |
3671 |
|
3672 |
/**************************************************************/ |
3673 |
/* Dump the Complex Line */ |
3674 |
/**************************************************************/ |
3675 |
if (shapeNumber != 0 || text != "") |
3676 |
{ |
3677 |
using (TextStyleTableRecord pTextStyle = (TextStyleTableRecord)(pRecord.ShapeStyleAt(i) == ObjectId.Null ? null : pRecord.ShapeStyleAt(i).Open(OpenMode.ForRead))) |
3678 |
{ |
3679 |
if (shapeNumber != 0) |
3680 |
{ |
3681 |
buffer = buffer + ",[" + shapeNumber + ","; |
3682 |
if (pTextStyle != null) |
3683 |
buffer = buffer + pTextStyle.FileName; |
3684 |
else |
3685 |
buffer = buffer + "NULL style"; |
3686 |
} |
3687 |
else |
3688 |
{ |
3689 |
buffer = buffer + ",[" + text + ","; |
3690 |
if (pTextStyle != null) |
3691 |
buffer = buffer + pTextStyle.Name; |
3692 |
else |
3693 |
buffer = buffer + "NULL style"; |
3694 |
} |
3695 |
} |
3696 |
|
3697 |
if (pRecord.ShapeScaleAt(i) != 0.0) |
3698 |
{ |
3699 |
buffer = buffer + ",S" + pRecord.ShapeScaleAt(i); |
3700 |
} |
3701 |
if (pRecord.ShapeRotationAt(i) != 0) |
3702 |
{ |
3703 |
buffer = buffer + ",R" + toDegreeString(pRecord.ShapeRotationAt(i)); |
3704 |
} |
3705 |
if (pRecord.ShapeOffsetAt(i).X != 0) |
3706 |
{ |
3707 |
buffer = buffer + ",X" + pRecord.ShapeOffsetAt(i).X; |
3708 |
} |
3709 |
if (pRecord.ShapeOffsetAt(i).Y != 0) |
3710 |
{ |
3711 |
buffer = buffer + ",Y" + pRecord.ShapeOffsetAt(i).Y; |
3712 |
} |
3713 |
buffer = buffer + "]"; |
3714 |
} |
3715 |
} |
3716 |
writeLine(indent, buffer); |
3717 |
} |
3718 |
dumpSymbolTableRecord(pRecord, indent, node); |
3719 |
LinetypeNode.AppendChild(RecordNode); |
3720 |
} |
3721 |
} |
3722 |
|
3723 |
node.AppendChild(LinetypeNode); |
3724 |
} |
3725 |
} |
3726 |
} |
3727 |
|
3728 |
public void dumpRegApps(Database pDb, int indent) |
3729 |
{ |
3730 |
/**********************************************************************/ |
3731 |
/* Get a pointer to the RegAppTable */ |
3732 |
/**********************************************************************/ |
3733 |
using (RegAppTable pTable = (RegAppTable)pDb.RegAppTableId.Open(OpenMode.ForRead)) |
3734 |
{ |
3735 |
/**********************************************************************/ |
3736 |
/* Dump the Description */ |
3737 |
/**********************************************************************/ |
3738 |
writeLine(); |
3739 |
writeLine(indent++, pTable.GetRXClass().Name); |
3740 |
|
3741 |
/**********************************************************************/ |
3742 |
/* Step through the RegAppTable */ |
3743 |
/**********************************************************************/ |
3744 |
foreach (ObjectId id in pTable) |
3745 |
{ |
3746 |
/*********************************************************************/ |
3747 |
/* Open the RegAppTableRecord for Reading */ |
3748 |
/*********************************************************************/ |
3749 |
using (RegAppTableRecord pRecord = (RegAppTableRecord)id.Open(OpenMode.ForRead)) |
3750 |
{ |
3751 |
/*********************************************************************/ |
3752 |
/* Dump the RegAppTableRecord */ |
3753 |
/*********************************************************************/ |
3754 |
writeLine(); |
3755 |
writeLine(indent, pRecord.GetRXClass().Name); |
3756 |
writeLine(indent, "Name", pRecord.Name); |
3757 |
} |
3758 |
} |
3759 |
} |
3760 |
} |
3761 |
|
3762 |
public void dumpSymbolTableRecord(SymbolTableRecord pRecord, int indent, XmlNode node) |
3763 |
{ |
3764 |
writeLine(indent, "Xref dependent", pRecord.IsDependent); |
3765 |
if (pRecord.IsDependent) |
3766 |
{ |
3767 |
writeLine(indent, "Resolved", pRecord.IsResolved); |
3768 |
} |
3769 |
} |
3770 |
|
3771 |
public void dumpTextStyles(Database pDb, int indent, XmlNode node) |
3772 |
{ |
3773 |
/**********************************************************************/ |
3774 |
/* Get a SmartPointer to the TextStyleTable */ |
3775 |
/**********************************************************************/ |
3776 |
using (TextStyleTable pTable = (TextStyleTable)pDb.TextStyleTableId.Open(OpenMode.ForRead)) |
3777 |
{ |
3778 |
/**********************************************************************/ |
3779 |
/* Dump the Description */ |
3780 |
/**********************************************************************/ |
3781 |
writeLine(); |
3782 |
writeLine(indent++, pTable.GetRXClass().Name); |
3783 |
|
3784 |
/**********************************************************************/ |
3785 |
/* Step through the TextStyleTable */ |
3786 |
/**********************************************************************/ |
3787 |
foreach (ObjectId id in pTable) |
3788 |
{ |
3789 |
/*********************************************************************/ |
3790 |
/* Open the TextStyleTableRecord for Reading */ |
3791 |
/*********************************************************************/ |
3792 |
using (TextStyleTableRecord pRecord = (TextStyleTableRecord)id.Open(OpenMode.ForRead)) |
3793 |
{ |
3794 |
/*********************************************************************/ |
3795 |
/* Dump the TextStyleTableRecord */ |
3796 |
/*********************************************************************/ |
3797 |
writeLine(); |
3798 |
writeLine(indent, pRecord.GetRXClass().Name); |
3799 |
writeLine(indent, "Name", pRecord.Name); |
3800 |
writeLine(indent, "Shape File", pRecord.IsShapeFile); |
3801 |
writeLine(indent, "Text Height", pRecord.TextSize); |
3802 |
writeLine(indent, "Width Factor", pRecord.XScale); |
3803 |
writeLine(indent, "Obliquing Angle", toDegreeString(pRecord.ObliquingAngle)); |
3804 |
writeLine(indent, "Backwards", (pRecord.FlagBits & 2)); |
3805 |
writeLine(indent, "Vertical", pRecord.IsVertical); |
3806 |
writeLine(indent, "Upside Down", (pRecord.FlagBits & 4)); |
3807 |
writeLine(indent, "Filename", shortenPath(pRecord.FileName)); |
3808 |
writeLine(indent, "BigFont Filename", shortenPath(pRecord.BigFontFileName)); |
3809 |
|
3810 |
FontDescriptor fd = pRecord.Font; |
3811 |
writeLine(indent, "Typeface", fd.TypeFace); |
3812 |
writeLine(indent, "Character Set", fd.CharacterSet); |
3813 |
writeLine(indent, "Bold", fd.Bold); |
3814 |
writeLine(indent, "Italic", fd.Italic); |
3815 |
writeLine(indent, "Font Pitch & Family", toHexString(fd.PitchAndFamily)); |
3816 |
dumpSymbolTableRecord(pRecord, indent, node); |
3817 |
} |
3818 |
} |
3819 |
} |
3820 |
} |
3821 |
public void dumpAbstractViewTableRecord(AbstractViewTableRecord pView, int indent, XmlNode node) |
3822 |
{ |
3823 |
/*********************************************************************/ |
3824 |
/* Dump the AbstractViewTableRecord */ |
3825 |
/*********************************************************************/ |
3826 |
writeLine(indent, "Back Clip Dist", pView.BackClipDistance); |
3827 |
writeLine(indent, "Back Clip Enabled", pView.BackClipEnabled); |
3828 |
writeLine(indent, "Front Clip Dist", pView.FrontClipDistance); |
3829 |
writeLine(indent, "Front Clip Enabled", pView.FrontClipEnabled); |
3830 |
writeLine(indent, "Front Clip at Eye", pView.FrontClipAtEye); |
3831 |
writeLine(indent, "Elevation", pView.Elevation); |
3832 |
writeLine(indent, "Height", pView.Height); |
3833 |
writeLine(indent, "Width", pView.Width); |
3834 |
writeLine(indent, "Lens Length", pView.LensLength); |
3835 |
writeLine(indent, "Render Mode", pView.RenderMode); |
3836 |
writeLine(indent, "Perspective", pView.PerspectiveEnabled); |
3837 |
writeLine(indent, "UCS Name", pView.UcsName); |
3838 |
|
3839 |
//writeLine(indent, "UCS Orthographic", pView.IsUcsOrthographic(orthoUCS)); |
3840 |
//writeLine(indent, "Orthographic UCS", orthoUCS); |
3841 |
|
3842 |
if (pView.UcsOrthographic != OrthographicView.NonOrthoView) |
3843 |
{ |
3844 |
writeLine(indent, "UCS Origin", pView.Ucs.Origin); |
3845 |
writeLine(indent, "UCS x-Axis", pView.Ucs.Xaxis); |
3846 |
writeLine(indent, "UCS y-Axis", pView.Ucs.Yaxis); |
3847 |
} |
3848 |
|
3849 |
writeLine(indent, "Target", pView.Target); |
3850 |
writeLine(indent, "View Direction", pView.ViewDirection); |
3851 |
writeLine(indent, "Twist Angle", toDegreeString(pView.ViewTwist)); |
3852 |
dumpSymbolTableRecord(pView, indent, node); |
3853 |
} |
3854 |
public void dumpDimAssoc(DBObject pObject, int indent) |
3855 |
{ |
3856 |
|
3857 |
} |
3858 |
public void dumpMLineStyles(Database pDb, int indent) |
3859 |
{ |
3860 |
using (DBDictionary pDictionary = (DBDictionary)pDb.MLStyleDictionaryId.Open(OpenMode.ForRead)) |
3861 |
{ |
3862 |
/**********************************************************************/ |
3863 |
/* Dump the Description */ |
3864 |
/**********************************************************************/ |
3865 |
writeLine(); |
3866 |
writeLine(indent++, pDictionary.GetRXClass().Name); |
3867 |
|
3868 |
/**********************************************************************/ |
3869 |
/* Step through the MlineStyle dictionary */ |
3870 |
/**********************************************************************/ |
3871 |
DbDictionaryEnumerator e = pDictionary.GetEnumerator(); |
3872 |
while (e.MoveNext()) |
3873 |
{ |
3874 |
try |
3875 |
{ |
3876 |
using (MlineStyle pEntry = (MlineStyle)e.Value.Open(OpenMode.ForRead)) |
3877 |
{ |
3878 |
/*********************************************************************/ |
3879 |
/* Dump the MLineStyle dictionary entry */ |
3880 |
/*********************************************************************/ |
3881 |
writeLine(); |
3882 |
writeLine(indent, pEntry.GetRXClass().Name); |
3883 |
writeLine(indent, "Name", pEntry.Name); |
3884 |
writeLine(indent, "Description", pEntry.Description); |
3885 |
writeLine(indent, "Start Angle", toDegreeString(pEntry.StartAngle)); |
3886 |
writeLine(indent, "End Angle", toDegreeString(pEntry.EndAngle)); |
3887 |
writeLine(indent, "Start Inner Arcs", pEntry.StartInnerArcs); |
3888 |
writeLine(indent, "End Inner Arcs", pEntry.EndInnerArcs); |
3889 |
writeLine(indent, "Start Round Cap", pEntry.StartRoundCap); |
3890 |
writeLine(indent, "End Round Cap", pEntry.EndRoundCap); |
3891 |
writeLine(indent, "Start Square Cap", pEntry.StartRoundCap); |
3892 |
writeLine(indent, "End Square Cap", pEntry.EndRoundCap); |
3893 |
writeLine(indent, "Show Miters", pEntry.ShowMiters); |
3894 |
/*********************************************************************/ |
3895 |
/* Dump the elements */ |
3896 |
/*********************************************************************/ |
3897 |
if (pEntry.Elements.Count > 0) |
3898 |
{ |
3899 |
writeLine(indent, "Elements:"); |
3900 |
} |
3901 |
int i = 0; |
3902 |
foreach (MlineStyleElement el in pEntry.Elements) |
3903 |
{ |
3904 |
writeLine(indent, "Index", (i++)); |
3905 |
writeLine(indent + 1, "Offset", el.Offset); |
3906 |
writeLine(indent + 1, "Color", el.Color); |
3907 |
writeLine(indent + 1, "Linetype", el.LinetypeId); |
3908 |
} |
3909 |
} |
3910 |
} |
3911 |
catch (System.Exception) |
3912 |
{ |
3913 |
} |
3914 |
} |
3915 |
} |
3916 |
} |
3917 |
public void dumpObject(ObjectId id, string itemName, int indent) |
3918 |
{ |
3919 |
using (DBObject pObject = id.Open(OpenMode.ForRead)) |
3920 |
{ |
3921 |
/**********************************************************************/ |
3922 |
/* Dump the item name and class name */ |
3923 |
/**********************************************************************/ |
3924 |
if (pObject is DBDictionary) |
3925 |
{ |
3926 |
writeLine(); |
3927 |
} |
3928 |
writeLine(indent++, itemName, pObject.GetRXClass().Name); |
3929 |
|
3930 |
/**********************************************************************/ |
3931 |
/* Dispatch */ |
3932 |
/**********************************************************************/ |
3933 |
if (pObject is DBDictionary) |
3934 |
{ |
3935 |
/********************************************************************/ |
3936 |
/* Dump the dictionary */ |
3937 |
/********************************************************************/ |
3938 |
DBDictionary pDic = (DBDictionary)pObject; |
3939 |
|
3940 |
/********************************************************************/ |
3941 |
/* Get a pointer to a new DictionaryIterator */ |
3942 |
/********************************************************************/ |
3943 |
DbDictionaryEnumerator pIter = pDic.GetEnumerator(); |
3944 |
|
3945 |
/********************************************************************/ |
3946 |
/* Step through the Dictionary */ |
3947 |
/********************************************************************/ |
3948 |
while (pIter.MoveNext()) |
3949 |
{ |
3950 |
/******************************************************************/ |
3951 |
/* Dump the Dictionary object */ |
3952 |
/******************************************************************/ |
3953 |
dumpObject(pIter.Value, pIter.Key, indent); |
3954 |
} |
3955 |
} |
3956 |
else if (pObject is Xrecord) |
3957 |
{ |
3958 |
/********************************************************************/ |
3959 |
/* Dump an Xrecord */ |
3960 |
/********************************************************************/ |
3961 |
Xrecord pXRec = (Xrecord)pObject; |
3962 |
dumpXdata(pXRec.Data, indent); |
3963 |
} |
3964 |
} |
3965 |
} |
3966 |
|
3967 |
public void dumpUCSTable(Database pDb, int indent, XmlNode node) |
3968 |
{ |
3969 |
/**********************************************************************/ |
3970 |
/* Get a pointer to the UCSTable */ |
3971 |
/**********************************************************************/ |
3972 |
using (UcsTable pTable = (UcsTable)pDb.UcsTableId.Open(OpenMode.ForRead)) |
3973 |
{ |
3974 |
/**********************************************************************/ |
3975 |
/* Dump the Description */ |
3976 |
/**********************************************************************/ |
3977 |
writeLine(); |
3978 |
writeLine(indent++, pTable.GetRXClass().Name); |
3979 |
|
3980 |
/**********************************************************************/ |
3981 |
/* Step through the UCSTable */ |
3982 |
/**********************************************************************/ |
3983 |
foreach (ObjectId id in pTable) |
3984 |
{ |
3985 |
/********************************************************************/ |
3986 |
/* Open the UCSTableRecord for Reading */ |
3987 |
/********************************************************************/ |
3988 |
using (UcsTableRecord pRecord = (UcsTableRecord)id.Open(OpenMode.ForRead)) |
3989 |
{ |
3990 |
/********************************************************************/ |
3991 |
/* Dump the UCSTableRecord */ |
3992 |
/********************************************************************/ |
3993 |
writeLine(); |
3994 |
writeLine(indent, pRecord.GetRXClass().Name); |
3995 |
writeLine(indent, "Name", pRecord.Name); |
3996 |
writeLine(indent, "UCS Origin", pRecord.Origin); |
3997 |
writeLine(indent, "UCS x-Axis", pRecord.XAxis); |
3998 |
writeLine(indent, "UCS y-Axis", pRecord.YAxis); |
3999 |
dumpSymbolTableRecord(pRecord, indent, node); |
4000 |
} |
4001 |
} |
4002 |
} |
4003 |
} |
4004 |
public void dumpViewports(Database pDb, int indent, XmlNode node) |
4005 |
{ |
4006 |
/**********************************************************************/ |
4007 |
/* Get a pointer to the ViewportTable */ |
4008 |
/**********************************************************************/ |
4009 |
using (ViewportTable pTable = (ViewportTable)pDb.ViewportTableId.Open(OpenMode.ForRead)) |
4010 |
{ |
4011 |
/**********************************************************************/ |
4012 |
/* Dump the Description */ |
4013 |
/**********************************************************************/ |
4014 |
writeLine(); |
4015 |
writeLine(indent++, pTable.GetRXClass().Name); |
4016 |
|
4017 |
/**********************************************************************/ |
4018 |
/* Step through the ViewportTable */ |
4019 |
/**********************************************************************/ |
4020 |
foreach (ObjectId id in pTable) |
4021 |
{ |
4022 |
/*********************************************************************/ |
4023 |
/* Open the ViewportTableRecord for Reading */ |
4024 |
/*********************************************************************/ |
4025 |
using (ViewportTableRecord pRecord = (ViewportTableRecord)id.Open(OpenMode.ForRead)) |
4026 |
{ |
4027 |
/*********************************************************************/ |
4028 |
/* Dump the ViewportTableRecord */ |
4029 |
/*********************************************************************/ |
4030 |
writeLine(); |
4031 |
writeLine(indent, pRecord.GetRXClass().Name); |
4032 |
writeLine(indent, "Name", pRecord.Name); |
4033 |
writeLine(indent, "Circle Sides", pRecord.CircleSides); |
4034 |
writeLine(indent, "Fast Zooms Enabled", pRecord.FastZoomsEnabled); |
4035 |
writeLine(indent, "Grid Enabled", pRecord.GridEnabled); |
4036 |
writeLine(indent, "Grid Increments", pRecord.GridIncrements); |
4037 |
writeLine(indent, "Icon at Origin", pRecord.IconAtOrigin); |
4038 |
writeLine(indent, "Icon Enabled", pRecord.IconEnabled); |
4039 |
writeLine(indent, "Iso snap Enabled", pRecord.IsometricSnapEnabled); |
4040 |
writeLine(indent, "Iso Snap Pair", pRecord.SnapPair); |
4041 |
writeLine(indent, "UCS Saved w/Vport", pRecord.UcsSavedWithViewport); |
4042 |
writeLine(indent, "UCS follow", pRecord.UcsFollowMode); |
4043 |
writeLine(indent, "Lower-Left Corner", pRecord.LowerLeftCorner); |
4044 |
writeLine(indent, "Upper-Right Corner", pRecord.UpperRightCorner); |
4045 |
writeLine(indent, "Snap Angle", toDegreeString(pRecord.SnapAngle)); |
4046 |
writeLine(indent, "Snap Base", pRecord.SnapBase); |
4047 |
writeLine(indent, "Snap Enabled", pRecord.SnapEnabled); |
4048 |
writeLine(indent, "Snap Increments", pRecord.SnapIncrements); |
4049 |
dumpAbstractViewTableRecord(pRecord, indent, node); |
4050 |
} |
4051 |
} |
4052 |
} |
4053 |
} |
4054 |
|
4055 |
/************************************************************************/ |
4056 |
/* Dump the ViewTable */ |
4057 |
/************************************************************************/ |
4058 |
public void dumpViews(Database pDb, int indent, XmlNode node) |
4059 |
{ |
4060 |
/**********************************************************************/ |
4061 |
/* Get a pointer to the ViewTable */ |
4062 |
/**********************************************************************/ |
4063 |
using (ViewTable pTable = (ViewTable)pDb.ViewTableId.Open(OpenMode.ForRead)) |
4064 |
{ |
4065 |
/**********************************************************************/ |
4066 |
/* Dump the Description */ |
4067 |
/**********************************************************************/ |
4068 |
writeLine(); |
4069 |
writeLine(indent++, pTable.GetRXClass().Name); |
4070 |
|
4071 |
/**********************************************************************/ |
4072 |
/* Step through the ViewTable */ |
4073 |
/**********************************************************************/ |
4074 |
foreach (ObjectId id in pTable) |
4075 |
{ |
4076 |
/*********************************************************************/ |
4077 |
/* Open the ViewTableRecord for Reading */ |
4078 |
/*********************************************************************/ |
4079 |
using (ViewTableRecord pRecord = (ViewTableRecord)id.Open(OpenMode.ForRead)) |
4080 |
{ |
4081 |
/*********************************************************************/ |
4082 |
/* Dump the ViewTableRecord */ |
4083 |
/*********************************************************************/ |
4084 |
writeLine(); |
4085 |
writeLine(indent, pRecord.GetRXClass().Name); |
4086 |
writeLine(indent, "Name", pRecord.Name); |
4087 |
writeLine(indent, "Category Name", pRecord.CategoryName); |
4088 |
writeLine(indent, "Layer State", pRecord.LayerState); |
4089 |
|
4090 |
string layoutName = ""; |
4091 |
if (!pRecord.Layout.IsNull) |
4092 |
{ |
4093 |
using (Layout pLayout = (Layout)pRecord.Layout.Open(OpenMode.ForRead)) |
4094 |
layoutName = pLayout.LayoutName; |
4095 |
} |
4096 |
writeLine(indent, "Layout Name", layoutName); |
4097 |
writeLine(indent, "PaperSpace View", pRecord.IsPaperspaceView); |
4098 |
writeLine(indent, "Associated UCS", pRecord.IsUcsAssociatedToView); |
4099 |
writeLine(indent, "PaperSpace View", pRecord.ViewAssociatedToViewport); |
4100 |
dumpAbstractViewTableRecord(pRecord, indent, node); |
4101 |
} |
4102 |
} |
4103 |
} |
4104 |
} |
4105 |
/************************************************************************/ |
4106 |
/* Dump Xdata */ |
4107 |
/************************************************************************/ |
4108 |
public void dumpXdata(ResultBuffer xIter, int indent) |
4109 |
{ |
4110 |
if (xIter == null) |
4111 |
return; |
4112 |
writeLine(indent++, "Xdata:"); |
4113 |
/**********************************************************************/ |
4114 |
/* Step through the ResBuf chain */ |
4115 |
/**********************************************************************/ |
4116 |
foreach (TypedValue resbuf in xIter) |
4117 |
{ |
4118 |
writeLine(indent, resbuf); |
4119 |
} |
4120 |
} |
4121 |
} |
4122 |
class ExProtocolExtension |
4123 |
{ |
4124 |
} |
4125 |
|
4126 |
class Program |
4127 |
{ |
4128 |
public static XmlDocument xml = null; |
4129 |
public static double OffsetX = 0; |
4130 |
public static double OffsetY = 0; |
4131 |
public static double Scale = 0; |
4132 |
public static List<string> Layers = new List<string>(){ "MINOR", "INSTR", "ELECT", "INSTRUMENT", "LINES" }; |
4133 |
|
4134 |
static void Main(string[] args) |
4135 |
{ |
4136 |
/********************************************************************/ |
4137 |
/* Initialize Drawings.NET. */ |
4138 |
/********************************************************************/ |
4139 |
bool bSuccess = true; |
4140 |
Teigha.Runtime.Services.odActivate(ActivationData.userInfo, ActivationData.userSignature); |
4141 |
using (Teigha.Runtime.Services srv = new Teigha.Runtime.Services()) |
4142 |
{ |
4143 |
try |
4144 |
{ |
4145 |
HostApplicationServices.Current = new OdaMgdMViewApp.HostAppServ(); |
4146 |
/**********************************************************************/ |
4147 |
/* Display the Product and Version that created the executable */ |
4148 |
/**********************************************************************/ |
4149 |
Console.WriteLine("\nReadExMgd developed using {0} ver {1}", HostApplicationServices.Current.Product, HostApplicationServices.Current.VersionString); |
4150 |
|
4151 |
if (args.Length != 4) |
4152 |
{ |
4153 |
Console.WriteLine("\n\n\tusage: OdReadExMgd <filename> <OffsetX> <OffsetY> <Scale>"); |
4154 |
Console.WriteLine("\nPress ENTER to continue...\n"); |
4155 |
Console.ReadLine(); |
4156 |
bSuccess = false; |
4157 |
} |
4158 |
else |
4159 |
{ |
4160 |
Console.WriteLine("\n File Name = " + args[0]); |
4161 |
|
4162 |
double.TryParse(args[1], out Program.OffsetX); |
4163 |
double.TryParse(args[2], out Program.OffsetY); |
4164 |
double.TryParse(args[3], out Program.Scale); |
4165 |
Program.xml = new XmlDocument(); |
4166 |
{ |
4167 |
XmlNode root = xml.CreateElement("ID2"); |
4168 |
Program.xml.AppendChild(root); |
4169 |
|
4170 |
/******************************************************************/ |
4171 |
/* Create a database and load the drawing into it. |
4172 |
/* first parameter means - do not initialize database- it will be read from file |
4173 |
* second parameter is not used by Teigha.NET Classic - it is left for ARX compatibility. |
4174 |
* Note the 'using' clause - generally, wrappers should disposed after use, |
4175 |
* to close underlying database objects |
4176 |
/******************************************************************/ |
4177 |
using (Database pDb = new Database(false, false)) |
4178 |
{ |
4179 |
pDb.ReadDwgFile(args[0], FileShare.Read, true, ""); |
4180 |
HostApplicationServices.WorkingDatabase = pDb; |
4181 |
/****************************************************************/ |
4182 |
/* Display the File Version */ |
4183 |
/****************************************************************/ |
4184 |
Console.WriteLine("File Version: {0}", pDb.OriginalFileVersion); |
4185 |
/****************************************************************/ |
4186 |
/* Dump the database */ |
4187 |
/****************************************************************/ |
4188 |
DbDumper dumper = new DbDumper(); |
4189 |
dumper.dump(pDb, 0, Program.xml.DocumentElement); |
4190 |
} |
4191 |
Program.xml.Save(Path.Combine(Path.GetDirectoryName(args[0]) , Path.GetFileNameWithoutExtension(args[0]) + ".xml")); |
4192 |
} |
4193 |
} |
4194 |
} |
4195 |
/********************************************************************/ |
4196 |
/* Display the error */ |
4197 |
/********************************************************************/ |
4198 |
catch (System.Exception e) |
4199 |
{ |
4200 |
bSuccess = false; |
4201 |
Console.WriteLine("Teigha?NET for .dwg files Error: " + e.Message); |
4202 |
} |
4203 |
|
4204 |
if (bSuccess) |
4205 |
Console.WriteLine("OdReadExMgd Finished Successfully"); |
4206 |
} |
4207 |
} |
4208 |
} |
4209 |
} |