Esempio n. 1
0
        //methdo to execute all the other methods
        public Execution(Document tempDoc, ElementSet tempSelected, string name, int minSpace)
        {
            doc        = tempDoc;
            familyName = name;
            minSpacing = minSpace;

            ManageView view = new ManageView(doc);

            Intersectors.view3D = ManageView.view3D;

            DuctsAndTrays.trayDuctlist = ConverToList(tempSelected);

            CreateAndPlace createAndPlace = new CreateAndPlace(doc, familyName);

            using (TransactionGroup tx = new TransactionGroup(doc, "Support Generation"))
            {
                tx.Start();

                view.GetBoundsDetail();

                LeastWidthPoints();

                view.SetBounds();

                tx.Assimilate();
            }
        }
Esempio n. 2
0
        //method to do all creation and adjustment of instances
        private void CreateAdjustElement(Element hostEle, XYZ instancePoint, XYZ savePoint, double width, bool stru, double rod)
        {
            try
            {
                using (Transaction tx = new Transaction(doc, "Create Element"))
                {
                    tx.Start();
                    Element created = CreateAndPlace.CreateElement(instancePoint, hostEle, doc.GetElement(hostEle.LevelId) as Level);
                    Points.AddCreatedRecord(hostEle.Id, savePoint);

                    AdjustInstance.doc           = doc;
                    AdjustInstance.instance      = created;
                    AdjustInstance.hostElement   = hostEle;
                    AdjustInstance.instancePoint = instancePoint;
                    AdjustInstance.width         = width;
                    AdjustInstance.stru          = stru;
                    AdjustInstance.rod           = rod;
                    AdjustInstance.type          = ConfigurationData.type;

                    if (AdjustInstance.MakeAdjustments())
                    {
                        tx.Commit();
                    }
                    else
                    {
                        tx.RollBack();
                    }
                }
            }
            catch
            {
                throw new Exception();
            }
        }