Esempio n. 1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            frm_ECCAProgram ECCAProgramForm = new frm_ECCAProgram();

            ECCAProgramForm.ShowDialog();
            this.Close();
        }
Esempio n. 2
0
        public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData,
                                                ref string message, ElementSet elements)
        {
            UIApplication app   = commandData.Application;
            UIDocument    uidoc = app.ActiveUIDocument;
            Document      doc   = uidoc.Document;

            string expetedfilesavepath = "";

            if (doc.IsWorkshared)
            {
                expetedfilesavepath = ModelPathUtils.ConvertModelPathToUserVisiblePath(doc.GetWorksharingCentralModelPath());
            }
            else
            {
                expetedfilesavepath = doc.PathName;
            }

            string MyECCAFile = Path.GetDirectoryName(expetedfilesavepath) + "\\ECCalcAidFile.bin";



            ECCAProject myProject = new ECCAProject(MyECCAFile);

            try
            {
                IList <ElementId> selectedElements = uidoc.Selection.GetElementIds().ToList();
                if (selectedElements.Count > 0)
                {
                    Element selectedBeam        = doc.GetElement(selectedElements[0]);
                    bool    validStructuralBeam = ValidateStructuralBeam(selectedBeam);

                    if (validStructuralBeam == true)
                    {
                        ECCABeam newBeam = ConvertToECCABeam(selectedBeam);


                        if (!(myProject.BeamCollection.IsUnique(newBeam)))
                        {
                            MessageBox.Show("Note this beam already exisits in the collection, do you want to reset its properties?", "Warning ", MessageBoxButton.YesNo, MessageBoxImage.Warning);
                        }


                        frm_ECCAProgram ECCAMainProgram = new frm_ECCAProgram(myProject, newBeam);


                        ECCAMainProgram.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("The element you selected cannot be read as a structural beam");
                    }
                }

                //serialisation test
            }
            catch (Exception ex)
            {
            }

            return(Result.Succeeded);
        }