Ejemplo n.º 1
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            var uiapp = commandData.Application;
            var app   = uiapp.Application;

            App = app;
            var uidoc = uiapp.ActiveUIDocument;

            var doc = uidoc.Document;
            var sel = uidoc.Selection;

            var acview = doc.ActiveView;

            app.DocumentChanged += OnDocumentChanged;
            uiapp.Idling        += OnIdling;

            floor =
                sel.PickObject(ObjectType.Element, doc.GetSelectionFilter(m => m is Floor)).GetElement(doc) as Floor;

#if Revit2019
            CommandHandlerService.invokeCommandHandler("ID_OBJECTS_PROJECT_CURVE");
#endif



#if Revit2016
            //调用postablecommand
            var commandid = RevitCommandId.LookupPostableCommandId(PostableCommand.ModelLine);
            uiapp.PostCommand(commandid);
#endif


            return(Result.Succeeded);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 指定Revit命令Id,调用内部命令.
 /// </summary>
 public bool Invoke(string cmdId)
 {
     if (ExternalCommandHelper.CanExecute(cmdId))
     {
         ExternalCommandHelper.executeExternalCommand(cmdId);
         return(true);
     }
     else if (CommandHandlerService.canExecute(cmdId))
     {
         CommandHandlerService.invokeCommandHandler(cmdId);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            var uidoc = commandData.Application.ActiveUIDocument;
            var doc   = uidoc.Document;
            var sel   = uidoc.Selection;


            var dim =
                sel.PickObject(ObjectType.Element, doc.GetSelectionFilter(m => m is Dimension))
                .GetElement(doc) as Dimension;

            sel.SetElementIds(new List <ElementId>()
            {
                dim.Id
            });
            CommandHandlerService.invokeCommandHandler("ID_FLIP_DIMENSION_DIRECTION");

            return(Result.Succeeded);
        }
Ejemplo n.º 4
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            var uidoc = commandData.Application.ActiveUIDocument;
            var sel   = uidoc.Selection;


            var eleId = sel.PickObject(ObjectType.Element,
                                       uidoc.Document.GetSelectionFilter(m =>
            {
                return(m.Category.Id == new ElementId(BuiltInCategory.OST_Viewers));
            })).ElementId;

            string commandId = "ID_SECTION_GAP";

            sel.SetElementIds(new List <ElementId>()
            {
                eleId
            });

            CommandHandlerService.invokeCommandHandler(commandId);

            return(Result.Succeeded);
        }
Ejemplo n.º 5
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            var uidoc = commandData.Application.ActiveUIDocument;

            var sel = uidoc.Selection;
            var doc = uidoc.Document;

            var acview = doc.ActiveView as ViewSection;


            var ele = sel.PickObject(ObjectType.Element);

            sel.SetElementIds(new List <ElementId>()
            {
                ele.ElementId
            });                                                           //选中剖面符号

            CommandHandlerService.invokeCommandHandler("ID_SECTION_GAP"); //打断剖面符号


            sel.SetElementIds(new List <ElementId>());

            return(Result.Succeeded);
        }