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

            Autodesk.Revit.ApplicationServices.Application app = uiapp.Application;
            Document         doc              = uidoc.Document;
            ElementSelector  elementSelector  = new ElementSelector();
            Element          element          = elementSelector.SeclectElement(doc, uidoc);
            ParameterProcess parameterProcess = new ParameterProcess();

            SampleCreateSharedParameter sampleCreateSharedParameter = new SampleCreateSharedParameter(doc, app);

            sampleCreateSharedParameter.LINK = @"C:\Users\OAI-IICM\Desktop\APIRevit-C#\Project\IICM\API_revit_IICM_1020\Define\Structural-Parameters.txt";
            shareParameters.AddRange(sampleCreateSharedParameter.GetListShareParamerter(element));
            int loop = 1;

            do
            {
                foreach (Parameter para in element.Parameters)
                {
                    ParameterModel p = parameterProcess.GetParameterInformation(para, doc, id);

                    if (shareParameters.Contains(p.NAME))
                    {
                        listParamrter.Add(p);
                        id++;
                    }
                }
                if (listParamrter.Count > 0)
                {
                    break;
                }
                sampleCreateSharedParameter.CreateSampleSharedParameters(element);
                ++loop;
            } while (loop < 2);;
            ///show dialog update param
            ///
            using (FormIO formIO = new FormIO(listParamrter))
            {
                DialogResult dr = formIO.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    //do update
                    List <ParameterModel> listNewParam = new List <ParameterModel>();
                    listNewParam = formIO.VALUE;
                    foreach (var new_para in listNewParam)
                    {
                        parameterProcess.setParameterToElent(new_para.PARAMETER, doc, new_para.VALUE);
                    }
                }
            }

            return(Result.Succeeded);
            //throw new NotImplementedException();
        }
Ejemplo n.º 2
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
            UIDocument    uidoc = uiapp.ActiveUIDocument;

            Autodesk.Revit.ApplicationServices.Application app = uiapp.Application;
            Document        doc             = uidoc.Document;
            ElementSelector elementSelector = new ElementSelector();

            elementSelector.SeclectElement(doc, uidoc);
            Element element = elementSelector.e;
            SampleCreateSharedParameter sampleCreateSharedParameter = new SampleCreateSharedParameter(doc, app);

            sampleCreateSharedParameter.LINK = @"C:\Users\OAI-IICM\Desktop\APIRevit-C#\Project\IICM\API_revit_IICM_1020\Define\Structural-Parameters.txt";
            sampleCreateSharedParameter.CreateSampleSharedParameters(element);
            return(Result.Succeeded);
        }