Message 1 of 3
The volume surface does not appear in volumes dashboard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The next code to create a volume surface
but the new volume surface does not appear in the volumes dashboard , i wont to add it by code
public void CreateVolSurfae()
{
Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Editor ed = acDoc.Editor;
Database acCurDb = acDoc.Database;
CivilDocument acCivilDoc = CivilApplication.ActiveDocument;
try
{
using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction())
{
string surfaceName = "Volume-01";
var surOpt01 = new PromptEntityOptions("\n Select the base surface");
surOpt01.SetRejectMessage("\nSelect surface only");
surOpt01.AddAllowedClass(typeof(TinSurface), true);
var surSelect01 = ed.GetEntity(surOpt01);
if (surSelect01.Status != PromptStatus.OK) return;
if (surSelect01.Status == PromptStatus.OK)
{
var baseSurface = surSelect01.ObjectId;
var surOpt2 = new PromptEntityOptions("\n Select the compariso surface");
surOpt2.SetRejectMessage("\nSelect surface only");
surOpt2.AddAllowedClass(typeof(TinSurface), true);
var surSelect02 = ed.GetEntity(surOpt2);
if (surSelect02.Status != PromptStatus.OK) return;
if (surSelect02.Status == PromptStatus.OK)
{
var surfaceId2 = surSelect02.ObjectId;
ObjectId surfaceStyleId = acCivilDoc.Styles.SurfaceStyles[3];
ObjectId surfaceIdvol = TinVolumeSurface.Create(surfaceName, baseSurface, surfaceId2, surfaceStyleId);
TinVolumeSurface volumSurface = surfaceIdvol.GetObject(OpenMode.ForWrite) as TinVolumeSurface;
volumSurface.Rebuild();
volumSurface.GetVolumeProperties();
}
}
ts.Commit();
}
}
catch (System.Exception ex)
{
ed.WriteMessage("Failed happen" + ex.Message);
}
}