PromptEntityOptions entOpts2 = new PromptEntityOptions("\nSelect Volume Surface (only TIN): "); var _with2 = entOpts2; _with2.SetRejectMessage("\nObject invalid."); _with2.AddAllowedClass(typeof(Autodesk.Civil.DatabaseServices.TinVolumeSurface), true); _with2.AllowNone = true; _with2.AllowObjectOnLockedLayer = true; PromptEntityResult entRes2 = ed.GetEntity(entOpts2); if (entRes2.Status != PromptStatus.OK) return;
I have problems because I allow only TinSurfaceVolume to select but Civil 3D allow me TinSurface too.
Why?
Solved! Go to Solution.
Solved by Jeff_M. Go to Solution.
Well, I do this with transaction :
ObjectId IdsuperficieVolumen = entRes2.ObjectId; using (Transaction tr = db.TransactionManager.StartTransaction()) { CivDb.Surface SupSelect = (CivDb.Surface)IdsuperficieVolumen.GetObject(OpenMode.ForRead); if (SupSelect.IsVolumeSurface == false) { MessageBox.Show("La superfície seleccionada no es una superfície de Volumen.\nComando finalizado.", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Warning); ed.WriteMessage("\n"); return; }
But, can I do it without transaction during the prompt?
Thanks.
Nope, can't do it without the Transaction. (Well, you could just use Open/Close directly without a Transaction.) Even though the API differentiates between a TinSurface and a TinVolumeSurface, the underlying objects both have the same DXF name "AECC_TIN_SURFACE".
Yes, you´re right.
Moreover, I don´t like why Civil 3D differenciates some properties for TinVolumeSurface and GridVolumeSurface for VolumeSurfaceProperties.
I have to create an instance for TinVolumeSurface and another for GridVolumeSurface to get volume. I have to repeat the same code for each case.