private void cmdGridAdd_Click(System.Object eventSender, System.EventArgs eventArgs) { BaseObjs.acadActivate(); ObjectId idLineX = Stake_Grid.addToGroup(); string nameLayer = idLineX.getLayer(); int i = nameLayer.IndexOf("GRID"); string name = nameLayer.Substring(i); ResultBuffer rb = idLineX.getXData("GRID"); if (rb == null) { return; } TypedValue[] tvs = rb.AsArray(); int result = 0; string typ = ""; if (tvs[1].Value.ToString().isInteger(out result)) { GRIDNUMERIC.Add(idLineX.getHandle()); typ = "NUMERIC"; } else { GRIDALPHA.Add(idLineX.getHandle()); typ = "ALPHA"; } Stake_Dict.updateDictGRIDs(name, typ, "ADD", idLineX, idLineX.getHandle().ToString()); }
private void cmdGetNumeric_Click(System.Object eventSender, System.EventArgs eventArgs) { BaseObjs.acadActivate(); Entity ent = null; Point3d pnt3dPicked = Pub.pnt3dO; try { string msg = string.Format("\nSelect the {0}1{1} grid line:\n", 34.asciiToString(), 34.asciiToString()); ent = Base_Tools45.Select.selectEntity(typeof(Line), msg, "", out pnt3dPicked); if (ent == null) { return; } } catch (System.Exception) { return; } Line objGridNumeric1 = (Line)ent; Color color = new Color(); color = Color.FromColorIndex(Autodesk.AutoCAD.Colors.ColorMethod.ByBlock, 3); objGridNumeric1.ObjectId.changeProp(LineWeight.ByLayer, color); GRIDNUMERIC.Add(objGridNumeric1.Handle); int i = objGridNumeric1.Layer.IndexOf("GRID"); string strName = objGridNumeric1.Layer.Substring(i); Stake_Grid.setupGrid(objGridNumeric1.ObjectId, strName, "NUMERIC"); Stake_Dict.updateDictGRIDsWithBldgName(GRIDNUMERIC, strName, "NUMERIC"); }
private void cmdGridDelete_Click(System.Object eventSender, System.EventArgs eventArgs) { BaseObjs.acadActivate(); Point3d pnt3d = Pub.pnt3dO; Entity ent = Base_Tools45.Select.selectEntity(typeof(Line), "Select Grid LINE to delete:", "", out pnt3d); if (ent == null) { return; } Line objLineX = (Line)ent; int n = objLineX.Layer.IndexOf("GRID"); string strName = objLineX.Layer.Substring(n); ResultBuffer rb = objLineX.ObjectId.getXData("GRID"); TypedValue[] tvs = rb.AsArray(); string strType = ""; string strVal = tvs[1].Value.ToString(); int res = 0; if (strVal.isInteger(out res)) { strType = "NUMERIC"; for (int i = 1; i <= GRIDNUMERIC.Count; i++) { if (objLineX.Handle == GRIDNUMERIC[i]) { GRIDNUMERIC.RemoveAt(i); } } } else { strType = "ALPHA"; for (int i = 1; i <= GRIDALPHA.Count; i++) { if (objLineX.Handle == GRIDALPHA[i]) { GRIDALPHA.RemoveAt(i); } } } Stake_Dict.updateDictGRIDs(strName, strType, "DELETE", objLineX.ObjectId, objLineX.Handle.ToString()); objLineX.ObjectId.delete(); }
private void frmGrid_Load(object sender, System.EventArgs e) { this.Frame02.ForeColor = System.Drawing.Color.Yellow; for (int i = 4; i < 41; i++) { cbxNumeric.Items.Add(i.ToString()); } cbxNumeric.SelectedIndex = 0; for (int i = 65; i <= 72; i++) { cbxAlpha.Items.Add(i.asciiToString()); } for (int i = 74; i <= 90; i++) { cbxAlpha.Items.Add(i.asciiToString()); } cbxAlpha.SelectedIndex = 0; tbxOffsetV.Text = "-0.50"; optPBC.Checked = true; optOUT.Checked = true; optALT.Checked = true; ObjectId idDictGRIDS = ObjectId.Null; bool exists = false; try { idDictGRIDS = Dict.getNamedDictionary("GRIDS", out exists); } catch (System.Exception) { return; } List <DBDictionaryEntry> entries = Dict.getEntries(idDictGRIDS); if (entries.Count > 0) { setupControls(entries.Count); BLDG_COUNT = entries.Count; } if (BLDG_COUNT > 0) { } Stake_Dict.resetObjectIdsInDict(); }
public void frmStake_Load() { bool exists = false; ObjectId idDict = Dict.getNamedDictionary("STAKE_PNTS", out exists); this.Location = new System.Drawing.Point(0, 0); if (exists) { Stake_Misc.updateSTAKE_PNTS(idDict); } xRef.fixXrefs(); Stake_XRefStatus.reloadXRefs(); Stake_GetSurfaceCPNT.getSurfaceFromXRef("CPNT-ON", "GCAL"); BlockReference br = xRef.getXRefBlockReference("CNTL"); if (br == null) { Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("CNTL drawing not found. Exiting..."); return; } CNTL_LAYER = br.Layer; Stake_Dict.updateAlignData(); optBLDG.Checked = false; cboOffset.Items.Add(0); cboOffset.Items.Add(3); cboOffset.Items.Add(5); cboOffset.Items.Add(10); cboOffset.Items.Add(15); cboOffset.SelectedIndex = 0; cboInterval.Items.Add(10); cboInterval.Items.Add(20); cboInterval.Items.Add(25); cboInterval.Items.Add(50); cboInterval.Items.Add(100); cboInterval.SelectedIndex = 3; cboHeight.Items.Add(0); cboHeight.Items.Add(6); cboHeight.Items.Add(8); cboHeight.SelectedIndex = 1; cboTolerance.Items.Add(0); cboTolerance.Items.Add(5); cboTolerance.SelectedIndex = 1; cboDelta.Items.Add(2); cboDelta.Items.Add(3); cboDelta.Items.Add(4); cboDelta.Items.Add(8); cboDelta.SelectedIndex = 2; this.Text = "STAKE - Active Alignment is: NONE"; try { if (Environment.UserName == "john") { this.Height = 550; } else { this.Height = 500; } } catch (System.Exception) { } //CgPnt_Group.checkPntGroup("SPNT"); //Layer.manageLayers("SPNT-LABEL"); }
private void cmdPrintDictionary_Click(object sender, EventArgs e) { Stake_Dict.printDictionary(); }