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"); }
createGridAlign() { string strLayerName = null; ObjectId idPoly = Stake_Grid.createBldgPoly(); if ((idPoly == ObjectId.Null)) { return(ObjectId.Null); } int i = idPoly.getLayer().IndexOf("GRID"); string strAlignName = idPoly.getLayer().Substring(i); strLayerName = "STAKE" + "-" + strAlignName; Alignment objAlign = null; try { objAlign = Align.addAlignmentFromPoly(strAlignName, strLayerName, idPoly, "STAKE", "STAKE", false); } catch (System.Exception) { objAlign = Align.addAlignmentFromPoly(strAlignName, strLayerName, idPoly, "Standard", "Standard", false); } objAlign.ReferencePointStation = 100; fStake.ACTIVEALIGN = objAlign; fStake.HandleAlign = objAlign.Handle; fStake.objectID = objAlign.ObjectId; TypedValue[] tvs = new TypedValue[2]; tvs.SetValue(new TypedValue(1001, "CLASS"), 0); tvs.SetValue(new TypedValue(1000, fStake.ClassObj), 1); objAlign.ObjectId.setXData(tvs, "CLASS"); ResultBuffer rb = idPoly.getXData("GRID"); tvs = rb.AsArray(); objAlign.ObjectId.setXData(tvs, "GRID"); idPoly.delete(); return(objAlign.ObjectId); }
private void cmdAlignCreate_Click(System.Object eventSender, System.EventArgs eventArgs) { Stake_Grid.processGrid(); }
private void cmdIdGridSets_Click(System.Object eventSender, System.EventArgs eventArgs) { Stake_Grid.idGridSets(); }
private void cmdIdSecondary_Click(System.Object eventSender, System.EventArgs eventArgs) { Stake_Grid.idSecondaryGrids(); }
private void cmdEditBuildNames_Click(System.Object eventSender, System.EventArgs eventArgs) { Stake_Grid.editBldgNum(); }
private void cmdGridLabel_Click(System.Object eventSender, System.EventArgs eventArgs) { Stake_Grid.labelGrids(); }
selectAlignment(ObjectId idAlign) { Alignment objAlign = (Alignment)idAlign.getEnt(); AlgnData alignData = new AlgnData(); AlgnData alignDataX = new AlgnData(); Point3d pnt3dPicked = Pub.pnt3dO; string nameAlign = ""; if ((idAlign == null)) { idAlign = Align.selectAlign("\nSelect Alignment: ", "Alignment Selection Failed", out pnt3dPicked, out nameAlign); } ResultBuffer rb = idAlign.getXData("PROFILE"); if (rb == null) { return(false); } TypedValue[] tvs = rb.AsArray(); fStake.HandleProfileView = tvs[1].Value.ToString().stringToHandle(); rb = idAlign.getXData("CLASS"); if (rb == null) { return(false); } tvs = rb.AsArray(); string strClass = tvs[1].Value.ToString(); fStake.ClassObj = strClass; Alignment align = (Alignment)idAlign.getEnt(); fStake.ACTIVEALIGN = align; fStake.HandleAlign = idAlign.getHandle(); fStake.objectID = idAlign; int result = 0; for (int i = nameAlign.Length - 1; i >= 1; i += -1) { if (!nameAlign.Substring(i, 1).isInteger(out result)) { fStake.NameStakeObject = nameAlign.Substring(0, i); break; } } ObjectId idTable = ObjectId.Null; Table table = null; try { idTable = Stake_Table.getTableId(idAlign); } catch (System.Exception) { try { SelectionSet ss = Select.buildSSet(typeof(Table)); ObjectId[] ids = ss.GetObjectIds(); using (Transaction tr = BaseObjs.startTransactionDb()) { for (int i = 0; i < ids.Length; i++) { table = (Table)tr.GetObject(ids[i], OpenMode.ForRead); if (table.Cells[1, 1].Value.ToString() == nameAlign) { TypedValue[] t = new TypedValue[2]; t.SetValue(new TypedValue(1001, "TABLE"), 0); t.SetValue(new TypedValue(1005, ids[i].getHandle()), 1); idAlign.setXData(t, "TABLE"); break; } } } } catch (System.Exception) { Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Select Table Failed"); } } switch (fStake.algnData.Count) { case 0: alignData.AlignHandle = align.Handle; alignData.TableHandle = table.Handle; alignData.AlignID = idAlign; alignData.AlignName = nameAlign; alignData.AlignLayer = align.Layer; fStake.algnData.Add(alignData); break; case 1: alignData = fStake.algnData[0]; if (alignData.AlignHandle == align.Handle) { alignData.TableHandle = table.Handle; } else { alignDataX.AlignHandle = align.Handle; alignDataX.TableHandle = table.Handle; alignDataX.AlignID = idAlign; alignDataX.AlignName = align.Name; alignDataX.AlignLayer = align.Layer; fStake.algnData.Add(alignDataX); } break; default: bool boolFound = false; for (int i = fStake.algnData.Count; i > 1; i--) { alignDataX = fStake.algnData[i - 1]; alignData = fStake.algnData[i]; if (alignDataX.AlignHandle == alignData.AlignHandle) { fStake.algnData.RemoveAt(i); } } for (int i = 1; i < fStake.algnData.Count; i++) { alignData = fStake.algnData[i]; if (alignData.AlignHandle == objAlign.Handle) { alignData.TableHandle = idTable.getHandle(); boolFound = true; } } if (!boolFound) { alignDataX.AlignHandle = objAlign.Handle; alignDataX.TableHandle = idTable.getHandle(); alignDataX.AlignID = idAlign; alignDataX.AlignName = objAlign.Name; alignDataX.AlignLayer = objAlign.Layer; fStake.algnData.Add(alignDataX); } break; } fStake.POI_CALC = Stake_Table.resetPOI(idTable); Stake_Misc.set_fStakeProps(strClass); if (strClass == "BLDG") { Stake_Grid.updateGridCollections(objAlign.Name); Application.ShowModelessDialog(Application.MainWindow.Handle, fGrid, false); fStake.Hide(); } fStake.ACTIVEALIGN = objAlign; return(true); }
private void cmdDone_Click(object sender, EventArgs e) { Stake_Grid.updateDictGridsBldgNum(); this.Hide(); }