← Inbox

C3D-0551 · Read soil PDF underlay placement + clip (read-only) error

Underlay 157DC position/scale/rotation/transform, clip boundary, extents, draw order index.

Script file
C3D-0551.cs
Target
260711 - 281 Maranatha Trail R2.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload


string F(double d){ return d.ToString("F6"); }
ObjectId uid; Db.TryGetObjectId(new Handle(Convert.ToInt64("157DC",16)),out uid);
var u=(PdfReference)Tx.GetObject(uid,OpenMode.ForRead);
var d=(PdfDefinition)Tx.GetObject(u.DefinitionId,OpenMode.ForRead);
Log("pos="+F(u.Position.X)+","+F(u.Position.Y)+" scale="+F(u.ScaleFactors.X)+","+F(u.ScaleFactors.Y)+" rot="+F(u.Rotation)+" normal="+u.Normal);
Log("def file="+d.SourceFileName+" active="+d.ActiveFileName+" item="+d.ItemName+" units="+d.UnitsName+"?");
var m=u.Transform; var a=m.ToArray(); Log("transform="+string.Join(",",System.Array.ConvertAll(a,x=>x.ToString("R"))));
Log("clipInverted="+u.ClipInverted+" isClipped="+u.IsClipped);
var cb=u.GetClipBoundary(); var sb=new System.Text.StringBuilder(); foreach(Point2d p in cb) sb.Append(F(p.X)+","+F(p.Y)+" "); Log("clip(n="+cb.Count+") "+sb);
var x=u.GeometricExtents; Log("ext "+F(x.MinPoint.X)+","+F(x.MinPoint.Y)+" -> "+F(x.MaxPoint.X)+","+F(x.MaxPoint.Y));
// draw order neighbours
var ms=(BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db),OpenMode.ForRead);
var dot=(DrawOrderTable)Tx.GetObject(ms.DrawOrderTableId,OpenMode.ForRead);
var full=dot.GetFullDrawOrder(0); int idx=-1; for(int i=0;i<full.Count;i++) if(full[i]==uid) idx=i; Log("draworder index "+idx+" of "+full.Count);
Log("INSUNITS="+Db.Insunits);

Result

Status
error
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260711 - 281 Maranatha Trail, Lawrenceville, GA 30045, USA\260711 - 281 Maranatha Trail R2.dwg
Message
Compile error: (7,94): error CS1061: 'PdfDefinition' does not contain a definition for 'UnitsName' and no accessible extension method 'UnitsName' accepting a first argument of type 'PdfDefinition' could be found (are you missing a using directive or an assembly reference?); (9,23): error CS1061: 'PdfReference' does not contain a definition for 'ClipInverted' and no accessible extension method 'ClipInverted' accepting a first argument of type 'PdfReference' could be found (are you missing a using directive or an assembly reference?); (10,132): error CS0019: Operator '+' cannot be applied to operands of type 'string' and 'method group'
Entities
—
Duration
432 ms
Civil 3D
25.0.0.0

Notes

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

No notes yet.