Hi.
If I have TIN surfaces in drawing, I can read (transaction) that objects.
PromptEntityOptions entOpts2 = new PromptEntityOptions("\nSelect TIN surface: "); var _with2 = entOpts2; _with2.SetRejectMessage("\Incorrect object."); _with2.AddAllowedClass(typeof(Autodesk.Civil.DatabaseServices.TinSurface), true); _with2.AllowNone = true; _with2.AllowObjectOnLockedLayer = true; PromptEntityResult entRes2 = ed.GetEntity(entOpts2); if (entRes2.Status != PromptStatus.OK) return; ObjectId IdSurf = entRes2.ObjectId;
using (Transaction trans = db.TransactionManager.StartTransaction())
{
TinSurface sup = trans.GetObject(IdSurf, OpenMode.ForRead as TinSurface);
trans.Commit();
}
However, if I have corridor surfaces in the drawing, I can´t read them (doing the transaction), because CorridorSurfaces have "surfaceId" property and "ObjectId" is not valid.
So, How can I do it?
Thanks.
Solved! Go to Solution.
Solved by Jeff_M. Go to Solution.
Solved by Jeff_M. Go to Solution.
Moreover, I get this bug:
Ok.
Thanks Jeff.
Sorry.
How do you know if a TIN Surface is a corridor surface?
I don´t find any property in TinSurface class about this?
Perhaps, it was good an extension method (for TinSurfaces) like "IsFromCorridor".
Do I have to get a corridor surface List and compare their "Names" property with the "DisplayName" property of TinSurfaces, to guess if each surface is actually a corridor surface?
I have seen this:
Like so...
TinSurface tinsurf = civilEnt as TinSurface; if (tinsurf!=null) { for (int i = 0; i < tinsurf.Operations.Count; i++) { SurfaceOperation op = tinsurf.Operations[i]; if (op.Enabled && op.GetType() == typeof(SurfaceOperationCreatedFromCorridor)) { ed.WriteMessage("This is a Corridor surface.\r\n"); break; } } }
Great !
Now it´s a property (field) of my Surface List.
public static List<toolsC3D.Surfaces> ComprobarSuperficies_sonCorridorSurfaces(List<Surfaces> listSup) { Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; using (Transaction trans = db.TransactionManager.StartTransaction()) { for (int k = 0; k <= listSup.Count - 1; k++) //revisamos si cada superficie de la lista, es una superficie de obra lineal. { TinSurface tinsurf = trans.GetObject(listSup[k].Id, OpenMode.ForRead) as TinSurface; if (tinsurf != null) { for (int i = 0; i < tinsurf.Operations.Count; i++) { SurfaceOperation op = tinsurf.Operations[i]; if (op.Enabled && op.GetType() == typeof(SurfaceOperationCreatedFromCorridor)) { listSup[k].IsSurfaceCorridor = true; // ed.WriteMessage("This is a Corridor surface.\r\n"); } } } } trans.Commit(); } return listSup; }