← Inbox

C3DO-0714 · 261101 redline 3: field codes off the sheet, clean monument callouts done

Redline item 3: the point codes (WALL EP, WALL 2, BLDG COR, P STRIP, SW COR, IPF raw codes...) stop plotting. Point-group draw order: a new PLAT MONUMENTS group (IPF* and I IN CRT* = 243, 328, 330, 334; Iron Pin symbol, no label) goes on top; POB, IPF NS, PP, MH, FF, GAS, TBC stay above No Display; everything else drops below No Display. No group or point is deleted - the old order is in the log. Clean callouts on C-ANNO: IPF 1/2" RB (243), IPF 1" CTP (334), IPF 1" OTP (330), IPF 1/2" OTP (328).

Script file
C3DO-0714.cs
Target
261101 - 5491 Roswell Rd NE.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload


var lt=(LayerTable)Tx.GetObject(Db.LayerTableId,OpenMode.ForRead);
var ms=(BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db),OpenMode.ForWrite);
var tst=(TextStyleTable)Tx.GetObject(Db.TextStyleTableId,OpenMode.ForRead); var sty=tst.Has("Standard")?tst["Standard"]:Db.Textstyle;
Func<string,bool> already=(s)=>{ foreach(ObjectId id in ms){ var m=Tx.GetObject(id,OpenMode.ForRead) as MText; if(m!=null&&m.Contents==s) return true; } return false; };
Func<string,string,double,double,double,double,AttachmentPoint,double,MText> addMt=(layer,s,x,y,h,rot,att,w)=>{
  if(already(s)){ Log("  already there: "+s.Replace("\\P"," / ")); return null; }
  EnsureLayer(layer,7);
  var m=new MText(); m.SetDatabaseDefaults(); m.Layer=layer; m.TextStyleId=sty; m.TextHeight=h; m.Contents=s; m.Location=new Point3d(x,y,0); m.Rotation=rot*Math.PI/180; m.Attachment=att; if(w>0) m.Width=w;
  ms.AppendEntity(m); Tx.AddNewlyCreatedDBObject(m,true); Log("  placed '"+s.Replace("\\P"," / ")+"' ["+m.Handle+"]"); return m; };

var civ=CivilDoc;
ObjectId pin=ObjectId.Null; foreach(ObjectId sid in civ.Styles.PointStyles){ var st=(Autodesk.Civil.DatabaseServices.Styles.PointStyle)Tx.GetObject(sid,OpenMode.ForRead); if(st.Name=="Iron Pin"){ pin=sid; break; } }
if(pin.IsNull){ Log("point style Iron Pin missing - nothing done"); return; }
ObjectId gid=ObjectId.Null, blank=ObjectId.Null;
foreach(ObjectId id in civ.PointGroups){ var g=(Autodesk.Civil.DatabaseServices.PointGroup)Tx.GetObject(id,OpenMode.ForRead); if(g.Name=="PLAT MONUMENTS") gid=id; if(g.Name=="No Display") blank=id; }
if(blank.IsNull){ Log("No Display group missing - nothing done"); return; }
var before=new System.Collections.Generic.List<string>(); foreach(ObjectId id in civ.PointGroups.DrawOrder) before.Add(((Autodesk.Civil.DatabaseServices.PointGroup)Tx.GetObject(id,OpenMode.ForRead)).Name);
Log("draw order before: "+string.Join(" | ",before));
if(gid.IsNull){ gid=civ.PointGroups.Add("PLAT MONUMENTS"); Log("created group PLAT MONUMENTS"); }
{ var g=(Autodesk.Civil.DatabaseServices.PointGroup)Tx.GetObject(gid,OpenMode.ForWrite);
  var q=new Autodesk.Civil.DatabaseServices.StandardPointGroupQuery(); q.IncludeRawDescriptions="IPF*,I IN CRT*"; g.SetQuery(q);
  g.PointStyleId=pin; g.IsPointStyleOverridden=true;
  try{ g.PointLabelStyleId=ObjectId.Null; g.IsPointLabelStyleOverridden=true; }catch(System.Exception ex){ Log("label override to none failed: "+ex.Message); }
  g.Update(); Log("PLAT MONUMENTS: points "+string.Join(",",g.GetPointNumbers())+", style Iron Pin, label "+(g.PointLabelStyleId.IsNull?"none":"NOT none")); }
// order: monuments first, then the groups that stay visible, then No Display blanks the rest
var keep=new[]{"PLAT MONUMENTS","POB","IPF NS","PP","MH","FF","GAS","TBC"};
var byName=new System.Collections.Generic.Dictionary<string,ObjectId>(); foreach(ObjectId id in civ.PointGroups.DrawOrder) byName[((Autodesk.Civil.DatabaseServices.PointGroup)Tx.GetObject(id,OpenMode.ForRead)).Name]=id;
byName["PLAT MONUMENTS"]=gid;
var order=new ObjectIdCollection(); foreach(var n in keep) if(byName.ContainsKey(n)) order.Add(byName[n]);
order.Add(blank);
foreach(ObjectId id in civ.PointGroups.DrawOrder) if(!order.Contains(id)) order.Add(id);
civ.PointGroups.DrawOrder=order;
var after=new System.Collections.Generic.List<string>(); foreach(ObjectId id in civ.PointGroups.DrawOrder) after.Add(((Autodesk.Civil.DatabaseServices.PointGroup)Tx.GetObject(id,OpenMode.ForRead)).Name);
Log("item 3 draw order after (verified): "+string.Join(" | ",after));
Log("hidden behind No Display now: Copy of TBC (WALL/SW codes), UTIL, BUILDING (BLDG COR), FENCE, Display [SPECIFIC], TOPO, WALL ELEV, _All Points. FF elevations stay.");
addMt("C-ANNO","IPF 1/2\" RB",2232332.1800,1420445.2200,3.0,0,AttachmentPoint.TopRight,0);
addMt("C-ANNO","IPF 1\" CTP",2232601.4200,1420647.3600,3.0,0,AttachmentPoint.BottomLeft,0);
addMt("C-ANNO","IPF 1\" OTP",2232601.0300,1420461.4700,3.0,0,AttachmentPoint.MiddleLeft,0);
addMt("C-ANNO","IPF 1/2\" OTP",2232619.3000,1420377.3200,3.0,0,AttachmentPoint.MiddleLeft,0);
Ed.Regen();

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\261101 - Project\261101 - 5491 Roswell Rd NE.dwg
Message
Executed C3DO-0714 (0 entities touched).
Entities
—
Duration
579 ms
Civil 3D
25.0.0.0

Log

draw order before: POB | IPF NS | PP | Copy of TBC | MH | UTIL | FH | WM | FF | GAS | TBC | BUILDING | No Display | NORTHING_EASTING | FENCE | Display [SPECIFIC] | TOPO | WALL ELEV | TREES | _All Points
created group PLAT MONUMENTS
PLAT MONUMENTS: points 334,330,328,243, style Iron Pin, label none
item 3 draw order after (verified): PLAT MONUMENTS | POB | IPF NS | PP | MH | FF | GAS | TBC | No Display | Copy of TBC | UTIL | FH | WM | BUILDING | NORTHING_EASTING | FENCE | Display [SPECIFIC] | TOPO | WALL ELEV | TREES | _All Points
hidden behind No Display now: Copy of TBC (WALL/SW codes), UTIL, BUILDING (BLDG COR), FENCE, Display [SPECIFIC], TOPO, WALL ELEV, _All Points. FF elevations stay.
  placed 'IPF 1/2" RB' [2148D]
  placed 'IPF 1" CTP' [2148E]
  placed 'IPF 1" OTP' [2148F]
  placed 'IPF 1/2" OTP' [21490]

Notes

What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.

No notes yet.