Пример #1
0
        public FormUserSetting(Dictionary <int, string> connTypeDict)
        {
            InitializeComponent();

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

            try
            {
                XmlProcessor.xmlReader(PublicBlocks.settingFileName, out xmlDict);
                if (xmlDict.Count() != 0)
                {
                    tbMoment.Text     = xmlDict.Where(a => a.Key.Contains("MOMENT")).Select(a => a.Value).FirstOrDefault();
                    tbCantilever.Text = xmlDict.Where(a => a.Key.Contains("CANTILEVER")).Select(a => a.Value).FirstOrDefault();
                }
            }
            catch
            {
                Dictionary <string, string> backUpTypeDict = new Dictionary <string, string>();
                backUpTypeDict.Add("MOMENT", "MOMENT CONNECTION");
                backUpTypeDict.Add("CANTILEVER", "CANTILEVER CONNECTION");
                XmlProcessor.xmlWriter(PublicBlocks.settingFileName, backUpTypeDict);
            }

            //this will past to connection type selection list.
            foreach (var v in connTypeDict)
            {
                revitConnTypeList.Add(v.Value);
            }
        }
Пример #2
0
 private void butnOk_Click(object sender, EventArgs e)
 {
     renewTypeDict.Add("MOMENT", tbMoment.Text.ToUpper());
     renewTypeDict.Add("CANTILEVER", tbCantilever.Text.ToUpper());
     XmlProcessor.xmlWriter(PublicBlocks.settingFileName, renewTypeDict);
     this.DialogResult = DialogResult.OK;
 }
Пример #3
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();
                }
            }
        }