Show/Hide Grid Bubbles

Show/Hide Grid Bubbles

hoanghd218
Explorer Explorer
1,042 Views
0 Replies
Message 1 of 1

Show/Hide Grid Bubbles

hoanghd218
Explorer
Explorer

Hi everybody 

Recently, I'm creating an External Command to Hide or Show Grid Bubble.

Here is my simple Code ,when the command had completed , not things change in the active view but when I select a certain grid the check box has checked - the bubble not show.

#region Namespaces
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using System.Linq;
#endregion

namespace HoangHien
{
    [Transaction(TransactionMode.Manual)]
    public class Template : IExternalCommand
    {
        public Result Execute(
          ExternalCommandData commandData,
          ref string message,
          ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
            UIDocument uidoc = uiapp.ActiveUIDocument;
            Application app = uiapp.Application;
            Document doc = uidoc.Document;

            // Access current selection

            Selection sel = uidoc.Selection;
            var g = doc.GetElement(sel.GetElementIds().First()) as Grid;

           

            using (Transaction tx = new Transaction(doc))
            {
                tx.Start("Transaction Name");
                g.ShowBubbleInView(DatumEnds.End0, doc.ActiveView);

                //uidoc.RefreshActiveView();.

                
                tx.Commit();
            }
            doc.Regenerate();
            uidoc.RefreshActiveView();
            
            return Result.Succeeded;
        }
    }
}

Thank you for your help!

1,043 Views
0 Replies
Replies (0)