XYZ DrawShleifsAlert(XYZ point, Document doc, ViewDrafting view) { mainTirePoints.Add(new XYZ(point.X, point.Y + 0.08, 0)); //соответствие арк settings.loadSettings(); XYZ pointToReturn = point; ARKModule ark = null; FamilyInstance f = new FilteredElementCollector(doc, view.Id).OfClass(typeof(FamilyInstance)).Cast <FamilyInstance>().Where(x => arkmoduleIds.Contains(x.Id)).FirstOrDefault(); foreach (ARKModule module in ARKBLocks) { if (module.revitModule.Id == f.Id) { ark = module; } } //добавление экземпляров на виды по точке double len = 0; int index = 0; FamilyInstance next = null; foreach (MEPSystem mep in ark.alertSystems) { FamilySymbol famToPlace = new FilteredElementCollector(doc).OfClass(typeof(FamilySymbol)).Cast <FamilySymbol>().Where(x => x.Name == "ARKRIGHTOUTPUTOP").FirstOrDefault(); Transaction trans = new Transaction(doc); trans.Start("Помещен на рисунок"); pointToReturn = new XYZ(point.X, point.Y - index * len * 10 - index * 0.2, 0); next = doc.Create.NewFamilyInstance(pointToReturn, famToPlace, view); trans.Commit(); trans.Start("добавление параметров"); next.LookupParameter("ark").Set(Int32.Parse(ark.mark.Remove(ark.mark.IndexOf("ARK"), 3))); next.LookupParameter("номер шлейфа").Set(Double.Parse((index + 1).ToString()) /*Double.Parse(mep.LookupParameter("Комментарии").AsString().Remove(0,1))/*+Double.Parse(ark.revitModule.Symbol.LookupParameter("Количество шлейфов справа").AsInteger().ToString())*/);//ввести новый параметр double countShleifs = Double.Parse(ark.revitModule.Symbol.LookupParameter("Количество шлейфов справа").AsInteger().ToString()); next.LookupParameter("Количество шлейфов справа").Set(countShleifs); next.LookupParameter("Длина кабеля").Set(getNormalCount(Double.Parse(mep.LookupParameter("Длина").AsValueString()) / 1000)); SettingSections s = settings.getByIndex(settings.loadSettingByARK(ark.mark)); next.LookupParameter("type").Set(s.op); next.LookupParameter("Вид кабеля").Set(s.GetStrForDrawing()); trans.Commit(); DrawSensorsAlert(new XYZ(point.X + next.LookupParameter("Длина").AsDouble() * 10, point.Y - index * len * 10 - index * 0.2, 0), mep, Int32.Parse(ark.mark.Remove(ark.mark.IndexOf("ARK"), 3)), view, doc); len = next.LookupParameter("Ширина").AsDouble(); ++index; } return(new XYZ(point.X, point.Y - index * len * 10 - index * 0.2, 0)); }
private void Form1_Load(object sender, EventArgs e) { try { string[] s = File.ReadAllLines("C://ProgramData//Autodesk//Revit//Addins//2019//Linear//intocabin.set"); textBox1.Text = s[0]; textBox2.Text = s[1]; textBox5.Text = s[2]; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } try { foreach (ARKModule module in blocks) { int rowNumber = dataGridView1.Rows.Add(); dataGridView1.Rows[rowNumber].Cells["ColumnARK"].Value = module.getFullName(); } string set_path = "C://ProgramData//Autodesk//Revit//Addins//2019//Linear//settings.set"; string folder_path = File.ReadAllText("C://ProgramData//Autodesk//Revit//Addins//2019//Linear//settings.set"); label5.Text = folder_path; files = Directory.GetFiles(folder_path, "*.rfa"); if (files.Length != 0) { label6.Text = files.Length.ToString(); bindingSource1.DataSource = files; set_path = "C://ProgramData//Autodesk//Revit//Addins//2019//Linear//families.set"; string[] strs = File.ReadAllLines(set_path); int last; if (strs.Length > blocks.Count) { last = blocks.Count; } else { last = strs.Length; } for (int i = 0; i < last; i++) { dataGridView1.Rows[i].Cells["ColumnFamily"].Value = strs[i]; } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } try { foreach (ARKModule m in blocks) { listBox1.Items.Add(m.revitModule.LookupParameter("Марка").AsString()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } try { settings.loadSettings(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }