C3D-0319 · 260714 Huckaby R2: read the GRCV squiggle linetype definition done
READ-ONLY. Dumps the GRCV linetype (the AutoCAD squiggle power-line pattern already loaded here) dash by dash with its shape number, scale and the shape style/SHX file it needs, plus every shape-file text style in the drawing.
C# payload
// GRCV is the squiggle pattern already in this drawing. Read its definition, and check the
// GRCV.shx shape file it depends on is available - a shape linetype draws nothing if the SHX
// is missing.
Log("drawing: " + Db.Filename);
var ltt = (LinetypeTable)Tx.GetObject(Db.LinetypeTableId, OpenMode.ForRead);
foreach (string nm in new[] { "GRCV", "POWER_LINE" }) {
if (!ltt.Has(nm)) { Log(nm + ": not loaded"); continue; }
var r = (LinetypeTableRecord)Tx.GetObject(ltt[nm], OpenMode.ForRead);
Log(string.Format("{0}: dashes={1} patLen={2:F3} \"{3}\"", r.Name, r.NumDashes, r.PatternLength, r.Comments));
for (int i = 0; i < r.NumDashes; i++) {
string txt = ""; ObjectId sid = ObjectId.Null; double sc = 0;
try { txt = r.TextAt(i); } catch { }
try { sid = r.ShapeStyleAt(i); } catch { }
try { sc = r.ShapeScaleAt(i); } catch { }
string sname = "";
if (!sid.IsNull) { try { var ts = (TextStyleTableRecord)Tx.GetObject(sid, OpenMode.ForRead); sname = ts.Name + " file=" + ts.FileName; } catch { } }
int shp = 0; try { shp = r.ShapeNumberAt(i); } catch { }
Log(string.Format(" dash{0} len={1,7:F3} shapeNo={2} scale={3:F3} text=\"{4}\" style={5}",
i, r.DashLengthAt(i), shp, sc, txt, sname));
}
}
Log("");
Log("=== text styles that reference a .shx shape file ===");
var tst = (TextStyleTable)Tx.GetObject(Db.TextStyleTableId, OpenMode.ForRead);
foreach (ObjectId id in tst) {
var ts = (TextStyleTableRecord)Tx.GetObject(id, OpenMode.ForRead);
if (!ts.IsShapeFile) continue;
Log(string.Format("SHAPE STYLE name=\"{0}\" file={1}", ts.Name, ts.FileName));
}
Result
Log
drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714 - 285 Huckaby Rd R2.dwg GRCV: dashes=4 patLen=0.390 "GRCV---~~----~~---" dash0 len= 0.140 shapeNo=0 scale=1.000 text="" style= dash1 len= -0.050 shapeNo=133 scale=0.014 text="" style= file=GRCV.shx dash2 len= -0.060 shapeNo=0 scale=1.000 text="" style= dash3 len= 0.140 shapeNo=0 scale=1.000 text="" style= POWER_LINE: dashes=3 patLen=0.950 "Power line ----W----W----W----W----W---" dash0 len= 0.500 shapeNo=0 scale=1.000 text="" style= dash1 len= -0.200 shapeNo=0 scale=0.200 text="W" style=Standard file=simplex.shx dash2 len= -0.250 shapeNo=0 scale=1.000 text="" style= === text styles that reference a .shx shape file === SHAPE STYLE name="" file=ltypeshp.shx SHAPE STYLE name="" file=GRCV.shx
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.