Ejemplo n.º 1
0
        public static void ConnectionTypePlacer(Document doc, UIApplication uiApp, string targetType)
        {
            //COLLECT ALL CONNECTION TYPE
            Dictionary <int, string> revitConnTypeDict = new Dictionary <int, string>();

            PublicBlocks.ConnTypeCollector(doc, out revitConnTypeDict);

            Dictionary <string, string> xmlConnTypeDict = new Dictionary <string, string>();

            XmlProcessor.xmlReader(PublicBlocks.settingFileName, out xmlConnTypeDict);

            int connTypeId = -1;

            if (targetType != "PIN")
            {
                PublicBlocks.ConnectionTypeSelector(xmlConnTypeDict, revitConnTypeDict, targetType, out connTypeId);
            }

            //Get View info
            ViewItem currentView = new ViewItem();

            PublicBlocks.getCurrentView(doc, out currentView);
            int KeepRun = 0;

            while (KeepRun == 0)
            {
                Selection sel   = uiApp.ActiveUIDocument.Selection;
                XYZ       point = null;
                #region//Pick point
                try
                {
                    point = sel.PickPoint();
                }
                catch (Exception)
                {
                    return;
                }
                #endregion

                List <Beam> beamList = new List <Beam>();
                PublicBlocks.BeamFinder(doc, point, currentView.cutToBott, out beamList);

                using (Transaction t = new Transaction(doc, "Set end connection type"))
                {
                    t.Start();
                    foreach (Beam bm in beamList)
                    {
                        Element e         = doc.GetElement(bm.id);
                        int     targetEnd = 0;
                        PublicBlocks.TargetEndFinder(point, bm.end0, bm.end1, out targetEnd);
                        PublicBlocks.ConnectionModifier(doc, e, connTypeId, targetEnd);
                    }
                    t.Commit();
                }
            }
        }
Ejemplo n.º 2
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet)
        {
            UIApplication uiApp = commandData.Application;
            Document      doc   = commandData.Application.ActiveUIDocument.Document;

            string targetType = "PIN";

            PublicBlocks.ConnectionTypePlacer(doc, uiApp, targetType);

            return(Result.Succeeded);
        }
Ejemplo n.º 3
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet)
        {
            UIApplication uiApp = commandData.Application;
            Document      doc   = commandData.Application.ActiveUIDocument.Document;

            Dictionary <int, string> connTypeDict = new Dictionary <int, string>();

            PublicBlocks.ConnTypeCollector(doc, out connTypeDict);

            Dictionary <string, string> typeDict = new Dictionary <string, string>();

            using (FormUserSetting thisForm = new FormUserSetting(connTypeDict))
            {
                thisForm.ShowDialog();
                if (thisForm.DialogResult == System.Windows.Forms.DialogResult.Cancel)
                {
                    return(Result.Cancelled);
                }

                typeDict = thisForm.renewTypeDict;
            }

            return(Result.Succeeded);
        }