The volume surface does not appear in volumes dashboard

The volume surface does not appear in volumes dashboard

Ahmmed-saber
Enthusiast Enthusiast
713 Views
2 Replies
Message 1 of 3

The volume surface does not appear in volumes dashboard

Ahmmed-saber
Enthusiast
Enthusiast

 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

vol.png

 

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);
               }
          }

 

 

0 Likes
714 Views
2 Replies
Replies (2)
Message 2 of 3

hosneyalaa
Advisor
Advisor

Hi @Ahmmed-saber 

I think  civil 3d Api  is not supported

0 Likes
Message 3 of 3

Richard-Lionheart
Contributor
Contributor

I've always had to add it manually in the table.

 

RichardLionheart_0-1694550891697.png

 

RichardLionheart_1-1694550921303.png