Esempio n. 1
0
        public RenameElevationsDialog(Autodesk.Revit.ApplicationServices.Application application, List <KeyValuePair <ViewSection, String> > newNames)
        {
            InitializeComponent();

            titleLabel.Text = "LM2.Revit Rename Elevations";
            TextLabel.Text  = "Please review the list of elevation view names in the list and accept to change the names.";

            var dataSource = new BindingSource();

            dataSource.DataSource = newNames.Select(ConvertRow).ToList();

            dataGridView.AutoGenerateColumns = false;
            dataGridView.DataSource          = dataSource;
            elevationName.DataPropertyName   = "OldName";
            RenameTo.DataPropertyName        = "NewName";

            string nameList = String.Join(",", newNames.Select(ConvertRow).Select(r => r.ToString()));

            application.WriteJournalComment(nameList, true);

            dataGridView.Refresh();
        }
Esempio n. 2
0
        internal static BoundingBoxXYZ GrowBox(Autodesk.Revit.ApplicationServices.Application app, BoundingBoxXYZ box, double howMuch)
        {
            BoundingBoxXYZ newBox = null;

            for (int i = 0; i < 10; i++)
            {
                double offset = (double)i * howMuch;
                newBox = new BoundingBoxXYZ()
                {
                    Min = new XYZ(box.Min.X - offset, box.Min.Y - offset, box.Min.Z - offset),
                    Max = new XYZ(box.Max.X + offset, box.Max.Y + offset, box.Max.Z + offset)
                };

                if (IsBoxTooSmall(app, newBox) == false)
                {
                    return(newBox);
                }
            }

            // if we got here, we were unable to make it happy, but pass it back anyway?
            app.WriteJournalComment("Metamorphosis: Odd: Unable to grow box by " + howMuch + " and make it appropriate compared to " + app.ShortCurveTolerance, false);
            return(newBox);
        }