C3D-0165 · READ-ONLY: block definition geometry + loose flood note position [BLK-GEO] done
Reports the SS_BLOCK_11X17 definition origin and its attribute definitions with positions, heights, styles and layers, the loose flood note MText position and extents, and the block reference position and scale, so the note can be moved into the definition at the correct coordinates. No changes.
C# payload
// READ-ONLY. Geometry needed to move the loose flood note INTO the SS_BLOCK_11X17 definition:
// - the block definition's origin and extents
// - the loose MText 158D1's position, height, width and style
// - an existing attribute definition, to copy its text style / layer conventions
// Nothing is modified.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
Log("drawing: " + Db.Filename);
Log("=== SS_BLOCK_11X17 definition ===");
foreach (ObjectId btrId in bt) {
var btr = (BlockTableRecord)Tx.GetObject(btrId, OpenMode.ForRead);
if (btr.Name != "SS_BLOCK_11X17") continue;
Log(" name " + btr.Name);
Log(" origin " + btr.Origin.X.ToString("F4") + "," + btr.Origin.Y.ToString("F4"));
int n = 0, nAtt = 0;
foreach (ObjectId id in btr) {
n++;
if (Tx.GetObject(id, OpenMode.ForRead) is AttributeDefinition) nAtt++;
}
Log(" entities " + n + " (attribute definitions: " + nAtt + ")");
Log("");
Log(" attribute definitions:");
foreach (ObjectId id in btr) {
var ad = Tx.GetObject(id, OpenMode.ForRead) as AttributeDefinition;
if (ad == null) continue;
Log(String.Format(" {0,-22} pos {1,10:F4},{2,-10:F4} h={3:F4} style={4} layer={5} just={6}",
ad.Tag, ad.Position.X, ad.Position.Y, ad.Height, ad.TextStyleName, ad.Layer, ad.Justify));
}
}
Log("");
Log("=== the loose flood note in paper space ===");
var ps = (BlockTableRecord)Tx.GetObject(bt[BlockTableRecord.PaperSpace], OpenMode.ForRead);
foreach (ObjectId id in ps) {
var mt = Tx.GetObject(id, OpenMode.ForRead) as MText;
if (mt == null || mt.Contents.ToUpper().IndexOf("FLOOD") < 0) continue;
Log(" [" + mt.Handle + "] layer=" + mt.Layer + " style=" + mt.TextStyleName);
Log(" location " + mt.Location.X.ToString("F4") + "," + mt.Location.Y.ToString("F4"));
Log(" height " + mt.TextHeight.ToString("F4") + " width " + mt.Width.ToString("F4")
+ " attach " + mt.Attachment + " rotation " + (mt.Rotation * 180.0 / Math.PI).ToString("F2"));
var e = mt.GeometricExtents;
Log(" extents " + e.MinPoint.X.ToString("F4") + "," + e.MinPoint.Y.ToString("F4")
+ " -> " + e.MaxPoint.X.ToString("F4") + "," + e.MaxPoint.Y.ToString("F4"));
}
Log("");
Log("=== the title block reference (to map paper coords into block coords) ===");
foreach (ObjectId id in ps) {
var br = Tx.GetObject(id, OpenMode.ForRead) as BlockReference;
if (br == null || br.Name.ToUpper().IndexOf("SS_BLOCK") < 0) continue;
Log(" [" + br.Handle + "] " + br.Name);
Log(" position " + br.Position.X.ToString("F4") + "," + br.Position.Y.ToString("F4"));
Log(" scale " + br.ScaleFactors.X.ToString("F4") + "," + br.ScaleFactors.Y.ToString("F4")
+ " rotation " + (br.Rotation * 180.0 / Math.PI).ToString("F2"));
}
Result
Log
drawing: C:\Users\sanja\OneDrive\_SurveyDisco\SS_BLOCK_11X17.dwg
=== SS_BLOCK_11X17 definition ===
name SS_BLOCK_11X17
origin 0.0000,0.0000
entities 105 (attribute definitions: 10)
attribute definitions:
JOB_NO pos -5.0971,1.0643 h=0.1167 style=Standard layer=BLOCK_TB2 just=BaseLeft
SITE_ADDRESS pos -10.1358,1.8695 h=0.1167 style=Standard layer=BLOCK_TB2 just=BaseLeft
REF_DB_PG pos -10.1319,1.0505 h=0.1167 style=Standard layer=BLOCK_TB2 just=BaseLeft
LAND_LOT pos -7.6235,1.6008 h=0.1167 style=Standard layer=BLOCK_TB2 just=BaseLeft
DISTRICT pos -7.6200,1.3350 h=0.1167 style=Standard layer=BLOCK_TB2 just=BaseLeft
COUNTY pos -7.6269,1.0511 h=0.1167 style=Standard layer=BLOCK_TB2 just=BaseLeft
DATE pos -5.0733,1.5898 h=0.1167 style=Standard layer=BLOCK_TB2 just=BaseLeft
SUBDIVISION_NAME_LOT pos -2.8763,2.8216 h=0.1167 style=Standard layer=BLOCK_TB2 just=BaseLeft
PREP_FOR pos -10.0864,2.2368 h=0.1500 style=SIMPLEX layer=BLOCK_TB2 just=BaseLeft
SURVEY_TYPE pos -10.1839,2.8207 h=0.2000 style=SIMPLEX layer=BLOCK_TB2 just=BaseLeft
=== the loose flood note in paper space ===
[158D1] layer=BLOCK_NOTES_FLOOD style=L120
location 7.7231,3.3919
height 0.0550 width 2.9020 attach TopLeft rotation 0.00
extents 7.7231,2.9743 -> 10.6251,3.3919
=== the title block reference (to map paper coords into block coords) ===
[20355] SS_BLOCK_11X17
position 10.8150,0.2874
scale 1.0000,1.0000 rotation 0.00Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.