public MultiPosShapeView() { if (IsDesigner) { this.CellBackColor = System.Drawing.SystemColors.Control; } else { this.CellBackColor = DWGUtility.ModelBackgroundColor(); } mSelectedShape = string.Empty; mCellSize = new Size(475, 150); mSelectionColor = SystemColors.Highlight; this.Name = "MultiPosShapeView"; this.Size = new System.Drawing.Size(900, 450); this.SuspendLayout(); this.layoutPanel = new FlowLayoutPanel(); this.layoutPanel.Dock = DockStyle.Fill; this.layoutPanel.FlowDirection = FlowDirection.LeftToRight; this.layoutPanel.AutoScroll = true; this.Controls.Add(layoutPanel); this.ResumeLayout(false); mSelectedShape = string.Empty; pieceLengths = new Dictionary <int, List <string> >(); init = false; disposed = false; }
public void CMD_PosLength() { if (!CheckLicense.Check()) { return; } PromptSelectionResult selresult = DWGUtility.SelectAllPosUser(); if (selresult.Status != PromptStatus.OK) { return; } PromptKeywordOptions opts = new PromptKeywordOptions("L boyunu [Göster/giZle]: ", "Show Hide"); opts.AllowNone = false; PromptResult result = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.GetKeywords(opts); if (result.Status == PromptStatus.OK) { switch (result.StringResult) { case "Show": ShowPosLength(selresult.Value.GetObjectIds(), true); break; case "Hide": ShowPosLength(selresult.Value.GetObjectIds(), false); break; } } }
public void CMD_IncludePos() { if (!CheckLicense.Check()) { return; } PromptSelectionResult selresult = DWGUtility.SelectAllPosUser(); if (selresult.Status != PromptStatus.OK) { return; } PromptKeywordOptions opts = new PromptKeywordOptions("Metraja [Dahil et/metrajdan Cikar]: ", "Add Remove"); opts.AllowNone = false; PromptResult result = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.GetKeywords(opts); if (result.Status == PromptStatus.OK) { switch (result.StringResult) { case "Add": IcludePosinBOQ(selresult.Value.GetObjectIds(), true); break; case "Remove": IcludePosinBOQ(selresult.Value.GetObjectIds(), false); break; } } }
private void EmptyBalloons() { PromptSelectionResult result = DWGUtility.SelectAllPosUser(true); if (result.Status == PromptStatus.OK) { Database db = HostApplicationServices.WorkingDatabase; using (Transaction tr = db.TransactionManager.StartTransaction()) { try { foreach (SelectedObject sel in result.Value) { RebarPos pos = tr.GetObject(sel.ObjectId, OpenMode.ForWrite) as RebarPos; if (pos != null) { pos.Pos = ""; } } tr.Commit(); } catch (System.Exception ex) { MessageBox.Show("Error: " + ex.Message, "RebarPos", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
public FindReplaceForm() { InitializeComponent(); m_Selection = new ObjectId[0]; m_PosList = new SortedDictionary <string, List <ObjectId> >(); m_CountList = new SortedDictionary <string, List <ObjectId> >(); m_DiameterList = new SortedDictionary <string, List <ObjectId> >(); m_SpacingList = new SortedDictionary <string, List <ObjectId> >(); m_NoteList = new SortedDictionary <string, List <ObjectId> >(); m_MultiplierList = new SortedDictionary <int, List <ObjectId> >(); m_ShapeList = new SortedDictionary <string, List <ObjectId> >(); m_PosProperties = new Dictionary <string, SelectedPos>(); m_FindShape = string.Empty; m_ReplaceShape = string.Empty; m_FindFields = 0; m_ReplaceFields = 0; psvFind.BackColor = DWGUtility.ModelBackgroundColor(); psvReplace.BackColor = DWGUtility.ModelBackgroundColor(); init = false; }
private bool NumberPos() { // Pos error check PromptSelectionResult sel = DWGUtility.SelectAllPosUser(true); if (sel.Status != PromptStatus.OK) { return(false); } ObjectId[] items = sel.Value.GetObjectIds(); List <PosCheckResult> check = PosCheckResult.CheckAllInSelection(items, true, false); if (check.Count != 0) { PosCheckResult.ConsoleOut(check); Autodesk.AutoCAD.ApplicationServices.Application.DisplayTextScreen = true; return(false); } using (NumberingForm form = new NumberingForm()) { if (form.Init(items)) { if (Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(null, form, false) == System.Windows.Forms.DialogResult.OK) { return(true); } } } return(false); }
public PosShapesForm() { InitializeComponent(); m_Copies = new List <PosShape>(); posShapeView.BackColor = DWGUtility.ModelBackgroundColor(); }
public void SetCurrentGroup() { Autodesk.AutoCAD.Colors.Color countColor = new Autodesk.AutoCAD.Colors.Color(); Database db = HostApplicationServices.WorkingDatabase; using (Transaction tr = db.TransactionManager.StartTransaction()) { try { PosGroup item = tr.GetObject(PosGroup.GroupId, OpenMode.ForRead) as PosGroup; if (item == null) { return; } countColor = item.CountColor; } catch { ; } } CountOverrule.Instance.SetProperties(countColor); DWGUtility.RefreshAllPos(); }
public bool Init() { Database db = HostApplicationServices.WorkingDatabase; using (Transaction tr = db.TransactionManager.StartTransaction()) { try { PosGroup group = tr.GetObject(PosGroup.GroupId, OpenMode.ForRead) as PosGroup; if (group == null) { return(false); } mCopy.DrawingUnit = group.DrawingUnit; mCopy.DisplayUnit = group.DisplayUnit; mCopy.Precision = group.Precision; mCopy.MaxBarLength = group.MaxBarLength; mCopy.Bending = group.Bending; mCopy.Formula = group.Formula; mCopy.FormulaVariableLength = group.FormulaVariableLength; mCopy.FormulaLengthOnly = group.FormulaLengthOnly; mCopy.FormulaPosOnly = group.FormulaPosOnly; mCopy.StandardDiameters = group.StandardDiameters; mCopy.TextColor = group.TextColor; mCopy.PosColor = group.PosColor; mCopy.CircleColor = group.CircleColor; mCopy.MultiplierColor = group.MultiplierColor; mCopy.GroupColor = group.GroupColor; mCopy.NoteColor = group.NoteColor; mCopy.CurrentGroupHighlightColor = group.CurrentGroupHighlightColor; mCopy.CountColor = group.CountColor; mCopy.TextStyleId = group.TextStyleId; mCopy.NoteStyleId = group.NoteStyleId; mCopy.NoteScale = group.NoteScale; } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show("Error: " + ex.Message, "RebarPos", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return(false); } } mTextStyles = DWGUtility.GetTextStyles(); foreach (string name in mTextStyles.Keys) { cbTextStyle.Items.Add(name); cbNoteStyle.Items.Add(name); } SetGroup(); return(true); }
public TableStyleForm() { InitializeComponent(); m_Copies = new List <TableStyleCopy>(); m_Styles = new List <string>(); m_TextStyles = new Dictionary <string, ObjectId>(); tableView.BackColor = DWGUtility.ModelBackgroundColor(); }
public void CMD_HideShapes() { if (!CheckLicense.Check()) { return; } ShowShapes = false; DWGUtility.RefreshAllPos(); }
private void lbItems_DoubleClick(object sender, EventArgs e) { if (lbItems.SelectedItems.Count == 0) { return; } PosCheckResult check = lbItems.SelectedItems[0].Tag as PosCheckResult; DWGUtility.ZoomToObjects(check.Items); }
public void CMD_ToggleShapes() { if (!CheckLicense.Check()) { return; } ShowShapes = !ShowShapes; DWGUtility.RefreshAllPos(); }
public void SetShapes(string current, IEnumerable <string> inshapes) { m_Current = current; shapesView.SetShapes(inshapes); shapesView.CellBackColor = DWGUtility.ModelBackgroundColor(); shapesView.CellSize = new Size(190, 70); shapesView.SelectedShape = m_Current; shapesView.ShowShapeNames = true; shapesView.ShapeClick += new MultiPosShapeViewClickEventHandler(posShapeView_Click); }
public bool Init() { m_Styles = BOQStyle.GetAllBOQStyles(); if (m_Styles.Count == 0) { return(false); } foreach (string item in m_Styles) { TableStyleCopy copy = new TableStyleCopy(); BOQStyle style = BOQStyle.GetBOQStyle(item); copy.Name = item; copy.IsBuiltin = style.IsBuiltIn; copy.Columns = style.Columns; copy.PosColumn = style.PosLabel; copy.CountColumn = style.CountLabel; copy.DiameterColumn = style.DiameterLabel; copy.LengthColumn = style.LengthLabel; copy.ShapeColumn = style.ShapeLabel; copy.TotalLengthColumn = style.TotalLengthLabel; copy.DiameterListColumn = style.DiameterListLabel; copy.TotalLengthRow = style.DiameterLengthLabel; copy.UnitWeightRow = style.UnitWeightLabel; copy.WeightRow = style.WeightLabel; copy.GrossWeightRow = style.GrossWeightLabel; copy.MultiplierHeadingLabel = style.MultiplierHeadingLabel; copy.TextStyleId = style.TextStyleId; copy.HeadingStyleId = style.HeadingStyleId; copy.FootingStyleId = style.FootingStyleId; m_Copies.Add(copy); } m_TextStyles = DWGUtility.GetTextStyles(); foreach (string name in m_TextStyles.Keys) { cbTextStyle.Items.Add(name); cbHeadingStyle.Items.Add(name); cbFootingStyle.Items.Add(name); } PopulateList(); return(true); }
public EditPosForm() { InitializeComponent(); m_Pos = ObjectId.Null; m_Shape = string.Empty; m_StandardDiameters = new List <int>(); boundDimensions = new List <ObjectId>(); posShapeView.BackColor = DWGUtility.ModelBackgroundColor(); }
private void PosShapes() { using (PosShapesForm form = new PosShapesForm()) { if (form.Init(ShowShapes)) { if (Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(null, form, false) == DialogResult.OK) { ShowShapes = form.ShowShapes; DWGUtility.RefreshAllPos(); } } } }
private void btnOK_Click(object sender, EventArgs e) { // Apply changes Database db = HostApplicationServices.WorkingDatabase; using (Transaction tr = db.TransactionManager.StartTransaction()) { try { PosGroup group = tr.GetObject(PosGroup.GroupId, OpenMode.ForWrite) as PosGroup; group.DrawingUnit = mCopy.DrawingUnit; group.DisplayUnit = mCopy.DisplayUnit; group.Precision = mCopy.Precision; group.MaxBarLength = mCopy.MaxBarLength; group.Bending = mCopy.Bending; group.Formula = mCopy.Formula; group.FormulaVariableLength = mCopy.FormulaVariableLength; group.FormulaLengthOnly = mCopy.FormulaLengthOnly; group.FormulaPosOnly = mCopy.FormulaPosOnly; group.StandardDiameters = mCopy.StandardDiameters; group.TextColor = mCopy.TextColor; group.PosColor = mCopy.PosColor; group.CircleColor = mCopy.CircleColor; group.MultiplierColor = mCopy.MultiplierColor; group.GroupColor = mCopy.GroupColor; group.NoteColor = mCopy.NoteColor; group.CurrentGroupHighlightColor = mCopy.CurrentGroupHighlightColor; group.CountColor = mCopy.CountColor; group.TextStyleId = mCopy.TextStyleId; group.NoteStyleId = mCopy.NoteStyleId; group.NoteScale = mCopy.NoteScale; tr.Commit(); } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show("Error: " + ex.Message, "RebarPos", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } } DWGUtility.RefreshAllPos(); Close(); }
public GroupForm() { InitializeComponent(); Width = 340; bool allowCustomMarkers = true; pnlCustomize.Enabled = pnlCustomize.Visible = allowCustomMarkers; btnDisplayStandard.Enabled = btnDisplayStandard.Visible = allowCustomMarkers; btnDisplayBS.Enabled = btnDisplayBS.Visible = allowCustomMarkers; mCopy = new GroupCopy(); mTextStyles = new Dictionary <string, ObjectId>(); posStylePreview.BackColor = DWGUtility.ModelBackgroundColor(); }
private void btnDrawShapes_Click(object sender, EventArgs e) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; PromptPointResult result; using (EditorUserInteraction UI = ed.StartUserInteraction(this)) { result = ed.GetPoint("Açılım şablonun çizileceği yer: "); } if (result.Status == PromptStatus.OK) { DWGUtility.DrawShape(GetSelected(), result.Value, 75); MessageBox.Show("Açılımı şablon çerçevesi içine çizin ve tekrar bu diyalog kutusuna dönüp çizimden al düğmesini tıklayın." + Environment.NewLine + "Çizimden alırken poz şeklini çerçevesi ile birlikte seçin.", "RebarPos", MessageBoxButtons.OK, MessageBoxIcon.Information); } SetShape(); }
private void PosCheck() { PromptSelectionResult sel = DWGUtility.SelectAllPosUser(true); if (sel.Status != PromptStatus.OK) { return; } ObjectId[] items = sel.Value.GetObjectIds(); using (CheckForm form = new CheckForm()) { if (form.Init(items)) { Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(null, form, false); } } }
public void CMD_DumpShapes() { Autodesk.AutoCAD.EditorInput.Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; PromptPointResult result = ed.GetPoint("Baz noktası: "); if (result.Status != PromptStatus.OK) { return; } Point3d pt = result.Value; foreach (string name in PosShape.GetAllPosShapes()) { DWGUtility.DrawShape(name, pt, 100); pt = pt.Add(new Vector3d(0, 120, 0)); } }
private void PosExplode() { PromptSelectionResult sel = DWGUtility.SelectAllPosAndBOQTableUser(); if (sel.Status != PromptStatus.OK) { return; } Database db = HostApplicationServices.WorkingDatabase; using (Transaction tr = db.TransactionManager.StartTransaction()) { try { BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite); DBObjectCollection explodedEntites = new DBObjectCollection(); // Explode all selected entites foreach (ObjectId id in sel.Value.GetObjectIds()) { Entity en = (Entity)tr.GetObject(id, OpenMode.ForWrite); en.Explode(explodedEntites); en.Erase(); } // Create new entities foreach (DBObject obj in explodedEntites) { Entity en = (Entity)obj; btr.AppendEntity(en); tr.AddNewlyCreatedDBObject(en, true); } } catch (System.Exception ex) { MessageBox.Show("Error: " + ex.Message, "RebarPos", MessageBoxButtons.OK, MessageBoxIcon.Error); } tr.Commit(); } }
public void CMD_LastPosNumber() { if (!CheckLicense.Check()) { return; } PromptSelectionResult sel = DWGUtility.SelectAllPosUser(); if (sel.Status != PromptStatus.OK) { return; } ObjectId[] items = sel.Value.GetObjectIds(); int lastNum = GetLastPosNumber(items); if (lastNum != -1) { MessageBox.Show("Son poz numarası: " + lastNum.ToString(), "RebarPos", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
void extender_CustomColumnClick(object sender, CheckForm.ListViewExtender.CustomColumnClickEventArgs e) { if (e.ColumnIndex == 3) { // Fix if (e.Item == null) { return; } PosCheckResult check = e.Item.Tag as PosCheckResult; if (check.Fix()) { ReadPos(m_Items); PopulateList(); } } else if (e.ColumnIndex == 4) { // Zoom if (e.Item == null) { return; } PosCheckResult check = e.Item.Tag as PosCheckResult; DWGUtility.ZoomToObjects(check.Items); } else if (e.ColumnIndex == 5) { // Select and close form if (e.Item == null) { return; } PosCheckResult check = e.Item.Tag as PosCheckResult; Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.SetImpliedSelection(check.Items.ToArray()); Close(); } }
public DrawingPreview() { items = new List <Drawable>(); if (IsDesigner) { this.BackColor = System.Drawing.SystemColors.Control; } else { this.BackColor = DWGUtility.ModelBackgroundColor(); } this.ForeColor = System.Drawing.SystemColors.ControlText; this.Name = "DrawingPreview"; this.Size = new System.Drawing.Size(600, 400); m_Selected = false; m_SelectionColor = SystemColors.Highlight; init = false; disposed = false; suspended = false; }
private bool FindReplace(bool usePickSet) { // Pos error check PromptSelectionResult sel = DWGUtility.SelectAllPosUser(true); if (sel.Status != PromptStatus.OK) { return(false); } ObjectId[] items = sel.Value.GetObjectIds(); List <PosCheckResult> check = PosCheckResult.CheckAllInSelection(items, true, false); if (check.Count != 0) { PosCheckResult.ConsoleOut(check); Autodesk.AutoCAD.ApplicationServices.Application.DisplayTextScreen = true; return(false); } using (FindReplaceForm form = new FindReplaceForm()) { if (form.Init(items)) { if (Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(null, form, false) == System.Windows.Forms.DialogResult.OK) { return(true); } } else { MessageBox.Show("Çizimde poz bulunamadı.", "RebarPos", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } return(false); }
private bool DrawBOQ() { using (DrawBOQForm form = new DrawBOQForm()) { // Pos error check PromptSelectionResult sel = DWGUtility.SelectAllPosUser(); if (sel.Status != PromptStatus.OK) { return(false); } ObjectId[] items = sel.Value.GetObjectIds(); List <PosCheckResult> errors = PosCheckResult.CheckAllInSelection(items, true, false); List <PosCheckResult> warnings = PosCheckResult.CheckAllInSelection(items, false, true); if (errors.Count != 0) { PosCheckResult.ConsoleOut(errors); } if (warnings.Count != 0) { PosCheckResult.ConsoleOut(warnings); } if (errors.Count != 0) { Autodesk.AutoCAD.ApplicationServices.Application.DisplayTextScreen = true; return(false); } // Pos similarity check if (warnings.Count != 0) { Autodesk.AutoCAD.ApplicationServices.Application.DisplayTextScreen = true; PromptKeywordOptions opts = new PromptKeywordOptions("\nMetraja devam edilsin mi? [Evet/Hayir]", "Yes No"); PromptResult res = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.GetKeywords(opts); if (res.Status != PromptStatus.OK || res.StringResult == "No") { return(true); } } if (!form.Init()) { return(false); } if (Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(null, form, false) != System.Windows.Forms.DialogResult.OK) { return(true); } List <PosCopy> posList = new List <PosCopy>(); try { posList = PosCopy.ReadAllInSelection(items, true, PosCopy.PosGrouping.PosMarker); } catch (System.Exception ex) { MessageBox.Show("Error: " + ex.Message, "RebarPos", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (posList.Count == 0) { MessageBox.Show("Seçilen grupta poz mevcut değil.", "RebarPos", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } posList = RemoveEmpty(posList); if (!form.HideMissing) { posList = AddMissing(posList); } posList = SortList(posList); PromptPointResult result = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.GetPoint("Baz noktası: "); if (result.Status != PromptStatus.OK) { return(true); } Database db = HostApplicationServices.WorkingDatabase; using (Transaction tr = db.TransactionManager.StartTransaction()) { try { BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite); BOQTable table = new BOQTable(); table.SuspendUpdate(); Point3d pt = result.Value; table.TransformBy(Matrix3d.Displacement(pt.GetAsVector())); table.TransformBy(Matrix3d.Scaling(form.TextHeight, pt)); table.Note = form.TableNote; table.Heading = form.TableHeader; table.Footing = form.TableFooter; table.DisplayUnit = form.DisplayUnit; table.Precision = form.Precision; table.Multiplier = form.Multiplier; BOQStyle style = form.TableStyle; table.ColumnDef = style.Columns; table.TextStyleId = style.TextStyleId; table.HeadingStyleId = style.HeadingStyleId; table.FootingStyleId = style.FootingStyleId; table.PosLabel = style.PosLabel; table.CountLabel = style.CountLabel; table.DiameterLabel = style.DiameterLabel; table.LengthLabel = style.LengthLabel; table.ShapeLabel = style.ShapeLabel; table.TotalLengthLabel = style.TotalLengthLabel; table.DiameterListLabel = style.DiameterListLabel; table.DiameterLengthLabel = style.DiameterLengthLabel; table.UnitWeightLabel = style.UnitWeightLabel; table.WeightLabel = style.WeightLabel; table.GrossWeightLabel = style.GrossWeightLabel; table.MultiplierHeadingLabel = style.MultiplierHeadingLabel; table.MaxRows = form.TableRows; table.TableSpacing = form.TableMargin; double lengthScale = 1.0; switch (table.DisplayUnit) { case BOQTable.DrawingUnits.Millimeter: lengthScale = 1.0; break; case BOQTable.DrawingUnits.Centimeter: lengthScale = 0.1; break; case BOQTable.DrawingUnits.Decimeter: lengthScale = 0.01; break; case BOQTable.DrawingUnits.Meter: lengthScale = 0.001; break; } // Add rows foreach (PosCopy copy in posList) { if (copy.existing) { string a = string.Empty; string b = string.Empty; string c = string.Empty; string d = string.Empty; string e = string.Empty; string f = string.Empty; if (copy.isVarA) { a = (copy.minA * lengthScale).ToString("F0") + "~" + (copy.maxA * lengthScale).ToString("F0"); } else { a = (copy.minA * lengthScale).ToString("F0"); } if (copy.isVarB) { b = (copy.minB * lengthScale).ToString("F0") + "~" + (copy.maxB * lengthScale).ToString("F0"); } else { b = (copy.minB * lengthScale).ToString("F0"); } if (copy.isVarC) { c = (copy.minC * lengthScale).ToString("F0") + "~" + (copy.maxC * lengthScale).ToString("F0"); } else { c = (copy.minC * lengthScale).ToString("F0"); } if (copy.isVarD) { d = (copy.minD * lengthScale).ToString("F0") + "~" + (copy.maxD * lengthScale).ToString("F0"); } else { d = (copy.minD * lengthScale).ToString("F0"); } if (copy.isVarE) { e = (copy.minE * lengthScale).ToString("F0") + "~" + (copy.maxE * lengthScale).ToString("F0"); } else { e = (copy.minE * lengthScale).ToString("F0"); } if (copy.isVarF) { f = (copy.minF * lengthScale).ToString("F0") + "~" + (copy.maxF * lengthScale).ToString("F0"); } else { f = (copy.minF * lengthScale).ToString("F0"); } table.Items.Add(int.Parse(copy.pos), copy.count, double.Parse(copy.diameter), copy.length1, copy.length2, copy.isVarLength, copy.shapename, a, b, c, d, e, f); } else { table.Items.Add(int.Parse(copy.pos)); } } table.ResumeUpdate(); table.SetDatabaseDefaults(db); btr.AppendEntity(table); tr.AddNewlyCreatedDBObject(table, true); tr.Commit(); } catch (System.Exception ex) { MessageBox.Show("Error: " + ex.Message, "RebarPos", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } return(true); }
private void ReadSelection() { m_PosList = new SortedDictionary <string, List <ObjectId> >(); m_CountList = new SortedDictionary <string, List <ObjectId> >(); m_DiameterList = new SortedDictionary <string, List <ObjectId> >(); m_SpacingList = new SortedDictionary <string, List <ObjectId> >(); m_NoteList = new SortedDictionary <string, List <ObjectId> >(); m_MultiplierList = new SortedDictionary <int, List <ObjectId> >(); m_ShapeList = new SortedDictionary <string, List <ObjectId> >(); m_PosProperties = new Dictionary <string, SelectedPos>(); cbFindPosNumber.Items.Clear(); cbFindCount.Items.Clear(); cbFindDiameter.Items.Clear(); cbFindSpacing.Items.Clear(); cbFindNote.Items.Clear(); cbFindMultiplier.Items.Clear(); if (m_Selection == null || m_Selection.Length == 0) { return; } // Read all pos properties in selection Database db = HostApplicationServices.WorkingDatabase; using (Transaction tr = db.TransactionManager.StartTransaction()) { try { foreach (ObjectId id in m_Selection) { RebarPos pos = tr.GetObject(id, OpenMode.ForRead) as RebarPos; if (pos != null) { List <ObjectId> list = null; if (m_PosList.TryGetValue(pos.Pos, out list)) { list.Add(id); } else { m_PosList.Add(pos.Pos, new List <ObjectId>() { id }); } if (pos.Detached) { continue; } if (m_CountList.TryGetValue(pos.Count, out list)) { list.Add(id); } else { m_CountList.Add(pos.Count, new List <ObjectId>() { id }); } if (m_DiameterList.TryGetValue(pos.Diameter, out list)) { list.Add(id); } else { m_DiameterList.Add(pos.Diameter, new List <ObjectId>() { id }); } if (m_SpacingList.TryGetValue(pos.Spacing, out list)) { list.Add(id); } else { m_SpacingList.Add(pos.Spacing, new List <ObjectId>() { id }); } if (m_NoteList.TryGetValue(pos.Note, out list)) { list.Add(id); } else { m_NoteList.Add(pos.Note, new List <ObjectId>() { id }); } if (m_MultiplierList.TryGetValue(pos.Multiplier, out list)) { list.Add(id); } else { m_MultiplierList.Add(pos.Multiplier, new List <ObjectId>() { id }); } if (m_ShapeList.TryGetValue(pos.Shape, out list)) { list.Add(id); } else { m_ShapeList.Add(pos.Shape, new List <ObjectId>() { id }); } SelectedPos copy = null; if (!m_PosProperties.TryGetValue(pos.Pos, out copy)) { copy = new SelectedPos(); m_PosProperties.Add(pos.Pos, copy); } copy.SetFrom(pos); } } } catch (System.Exception) { ; } } // Populate list boxes foreach (string name in m_PosList.Keys) { cbFindPosNumber.Items.Add(name); } foreach (string name in m_CountList.Keys) { cbFindCount.Items.Add(name); } foreach (string name in m_DiameterList.Keys) { cbFindDiameter.Items.Add(name); } foreach (string name in m_SpacingList.Keys) { cbFindSpacing.Items.Add(name); } foreach (string name in m_NoteList.Keys) { cbFindNote.Items.Add(name); } foreach (int mult in m_MultiplierList.Keys) { cbFindMultiplier.Items.Add(mult.ToString()); } cbReplaceDiameter.Items.Clear(); foreach (int d in DWGUtility.GetStandardDiameters()) { cbReplaceDiameter.Items.Add(d.ToString()); } if (cbReplaceDiameter.Items.Count > 0) { cbReplaceDiameter.SelectedIndex = 0; } if (m_ShapeList.Count > 0) { foreach (string name in m_ShapeList.Keys) { SetFindShape(name); SetReplaceShape(name); break; } } if (cbFindPosNumber.Items.Count > 0) { cbFindPosNumber.SelectedIndex = 0; } if (cbFindCount.Items.Count > 0) { cbFindCount.SelectedIndex = 0; } if (cbFindDiameter.Items.Count > 0) { cbFindDiameter.SelectedIndex = 0; } if (cbFindSpacing.Items.Count > 0) { cbFindSpacing.SelectedIndex = 0; } if (cbFindNote.Items.Count > 0) { cbFindNote.SelectedIndex = 0; } if (cbFindMultiplier.Items.Count > 0) { cbFindMultiplier.SelectedIndex = 0; } }