private void cmdProfileView_Click(object sender, EventArgs e) { BaseObjs.acadActivate(); idProfileBandSetStyle = Prof_Style.getProfileViewBandSetStyle(); if (cbxProfileStyleDE.SelectedIndex == -1) { Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Please select Profile Style: "); return; } if (cbxProfileViewStyle.SelectedIndex == -1) { Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Please select Profile View Style: "); return; } idProfileStyleDE = Prof_Style.getProfileStyle(cbxProfileStyleDE.SelectedItem.ToString()); idProfileStyleEX = Prof_Style.getProfileStyle(cbxProfileStyleEX.SelectedItem.ToString()); idProfileLabelSetDE = Prof_Style.getProfileLabelSetStyle(cbxProfileLabelSetDE.SelectedItem.ToString()); idProfileLabelSetEX = Prof_Style.getProfileLabelSetStyle(cbxProfileLabelSetEX.SelectedItem.ToString()); idProfileViewStyle = Prof_Style.getProfileViewStyle(cbxProfileViewStyle.SelectedItem.ToString()); idProfileView = MNP_Profile.makeProfile(idAlign); }
addProfileView(ObjectId idAlign, bool boolMod) { ObjectId idProfileViewStyle = ObjectId.Null; ObjectId idProfileViewLabelSetStyle = ObjectId.Null; ObjectId idProfileViewBandSetStyle = ObjectId.Null; try { idProfileViewStyle = Prof_Style.getProfileViewStyle("STAKE"); } catch (System.Exception) { idProfileViewStyle = Prof_Style.getProfileViewStyle("Standard"); } try { idProfileViewBandSetStyle = Prof_Style.getProfileViewBandSetStyle("STAKE"); } catch (System.Exception) { idProfileViewBandSetStyle = Prof_Style.getProfileViewBandSetStyle("Standard"); } Point3d varPntPick = Pub.pnt3dO; PromptStatus ps; if (boolMod) { varPntPick = fStake.InsertProfileView; } else { varPntPick = UserInput.getPoint("Select insertion point for Profile View", out ps, osMode: 0); if (ps == PromptStatus.Cancel) { idAlign.delete(); return; } fStake.InsertProfileView = varPntPick; } string strLayerName = "PROFILES"; ObjectId idLayer = Layer.manageLayers(strLayerName); ProfileView pv = Prof.addProfileView(idAlign, varPntPick); Alignment objAlign = (Alignment)idAlign.getEnt(); pv.StationStart = objAlign.StartingStation; pv.StationEnd = objAlign.EndingStation; pv.Layer = strLayerName; fStake.HandleProfileView = pv.Handle; TypedValue[] tvs = new TypedValue[2] { new TypedValue(1001, "PROFILE"), new TypedValue(1000, pv.Handle) }; idAlign.setXData(tvs, "PROFILE"); }
CreateProfileViewPrelim(Alignment objAlign) { ObjectId id = ObjectId.Null; ProfileView objProfileView = null; ObjectId idPViewStyle = ObjectId.Null; ObjectId idPViewBandSetStyle = ObjectId.Null; Debug.Print("CreateProfileViewPrelim - Line 28"); try { idPViewStyle = Prof_Style.getProfileViewStyle("WALL"); idPViewBandSetStyle = Prof_Style.getProfileViewBandSetStyle("WALL"); } catch (Autodesk.AutoCAD.Runtime.Exception) { idPViewStyle = Prof_Style.getProfileViewStyle("Standard"); idPViewBandSetStyle = Prof_Style.getProfileViewBandSetStyle("Standard"); } PromptStatus ps = default(PromptStatus); Point3d pnt3dIns = default(Point3d); try { BaseObjs.acadActivate(); pnt3dIns = UserInput.getPoint("Select insertion point for Profile View", out ps, osMode: 0); } catch (Autodesk.AutoCAD.Runtime.Exception) { objAlign.Erase(); return(ObjectId.Null); } string strLayer = string.Format("{0}-PROFILEVIEW", objAlign.Name); Layer.manageLayers(strLayer); Debug.Print("CreateProfileViewPrelim - Line 74"); try { objProfileView = Prof.addProfileView(objAlign.ObjectId, pnt3dIns, idPViewBandSetStyle, idPViewStyle); } catch (Autodesk.AutoCAD.Runtime.Exception ex) { Application.ShowAlertDialog(ex.ToString()); } TypedValue[] tvs = new TypedValue[2] { new TypedValue(1001, "WALLDESIGN"), new TypedValue(1005, objProfileView.Handle) }; objProfileView.ObjectId.setXData(tvs, "WALLDESIGN"); tvs = new TypedValue[2] { new TypedValue(1001, "BRKLINE"), new TypedValue(1005, 0) }; objProfileView.ObjectId.setXData(tvs, "BRKLINE"); return(objProfileView.ObjectId); }
CreateWallProfileView(Alignment objAlign, List <AlgnEntData> algnEntDataList, Polyline3d objBrkLEFT, Polyline3d objBrkRIGHT, string strAPP) { ObjectId idAlign = objAlign.ObjectId; ObjectId idPViewStyle = default(ObjectId); ObjectId idPViewBandSetStyle = default(ObjectId); ProfileView objProfileView = default(ProfileView); string strLayer = null; List <staOffElev> sOffs = wd.convert3dPolyToPnt_Data(objAlign, algnEntDataList, objBrkLEFT.ObjectId, "BRKLEFT"); List <PNT_DATA> PntsBrkLEFT = new List <PNT_DATA>(); foreach (staOffElev s in sOffs) { PNT_DATA p = new PNT_DATA() { STA = s.staAlign, z = s.elev }; PntsBrkLEFT.Add(p); } wdp.CreateProfileByLayout2("BRKLEFT", objAlign, PntsBrkLEFT); sOffs = new List <staOffElev>(); sOffs = wd.convert3dPolyToPnt_Data(objAlign, algnEntDataList, objBrkRIGHT.ObjectId, "BRKRIGHT"); List <PNT_DATA> PntsBrkRIGHT = new List <PNT_DATA>(); foreach (staOffElev s in sOffs) { PNT_DATA p = new PNT_DATA() { STA = s.staAlign, z = s.elev }; PntsBrkRIGHT.Add(p); } wdp.CreateProfileByLayout2("BRKRIGHT", objAlign, PntsBrkRIGHT); Debug.Print("CreateProfileView - Line 45"); try { using (BaseObjs._acadDoc.LockDocument()) { idPViewStyle = Prof_Style.getProfileViewStyle("WALL"); if (idPViewStyle == ObjectId.Null) { idPViewStyle = Prof_Style.CreateProfileViewStyle("WALL"); if (idPViewStyle.IsNull) { idPViewStyle = BaseObjs._civDoc.Styles.ProfileViewStyles[0]; } } } using (BaseObjs._acadDoc.LockDocument()) { idPViewBandSetStyle = Prof_Style.getProfileViewBandSetStyle("WALL"); if (idPViewBandSetStyle == ObjectId.Null) { idPViewBandSetStyle = Prof_Style.CreateProfileViewBandSetStyle("WALL"); if (idPViewBandSetStyle.IsNull) { idPViewBandSetStyle = BaseObjs._civDoc.Styles.ProfileViewBandSetStyles[0]; } } } } catch (Autodesk.AutoCAD.Runtime.Exception ex) { Application.ShowAlertDialog(ex.ToString()); return(null); } PromptStatus ps = default(PromptStatus); Point3d pnt3dIns = default(Point3d); try { pnt3dIns = UserInput.getPoint("Select insertion point for Profile View", out ps, osMode: 0); } catch (Autodesk.AutoCAD.Runtime.Exception) { objAlign.Erase(); return(null); } strLayer = string.Format("{0}-PROFILEVIEW", objAlign.Name); Layer.manageLayers(strLayer); Debug.Print("CreateProfileView - Line 75"); using (BaseObjs._acadDoc.LockDocument()) { using (Transaction TR = BaseObjs.startTransactionDb()) { try { Prof.removeProfileViews(objAlign); } catch (Autodesk.AutoCAD.Runtime.Exception ex) { Application.ShowAlertDialog(ex.ToString()); } objProfileView = Prof.addProfileView(objAlign.ObjectId, pnt3dIns, idPViewBandSetStyle, idPViewStyle); TypedValue[] tvs = new TypedValue[2] { new TypedValue(1001, "WALLDESIGN"), new TypedValue(1005, objProfileView.Handle) }; idAlign.setXData(tvs, "WALLDESIGN"); tvs = new TypedValue[4] { new TypedValue(1001, "BRKRIGHT"), new TypedValue(1005, objBrkRIGHT.Handle), new TypedValue(1040, PntsBrkRIGHT[0].STA), new TypedValue(1040, PntsBrkRIGHT[PntsBrkRIGHT.Count - 1].STA) }; objProfileView.ObjectId.setXData(tvs, "BRKRIGHT"); tvs = new TypedValue[4] { new TypedValue(1001, "BRKLEFT"), new TypedValue(1005, objBrkLEFT.Handle), new TypedValue(1040, PntsBrkLEFT[0].STA), new TypedValue(1040, PntsBrkLEFT[PntsBrkLEFT.Count - 1].STA) }; objProfileView.ObjectId.setXData(tvs, "BRKLEFT"); Profile objProfile1 = Prof.getProfile(objAlign.ObjectId, "BRKLEFT"); //Prof.removeProfileLabelGroup(objProfileView.ObjectId, objProfile1.ObjectId) Profile objProfile2 = Prof.getProfile(objAlign.ObjectId, "BRKRIGHT"); //Prof.removeProfileLabelGroup(objProfileView.ObjectId, objProfile2.ObjectId) TR.Commit(); } } Debug.Print("CreateProfileView - Line 145"); return(objProfileView); }
CreateProfileView(ObjectId idAlign) { Debug.Print("CreateProfileView - Line 28"); ObjectId idPViewStyle = ObjectId.Null; ObjectId idPViewBandSetStyle = ObjectId.Null; try { idPViewStyle = Prof_Style.getProfileViewStyle("WALL"); idPViewBandSetStyle = Prof_Style.getProfileViewBandSetStyle("WALL"); } catch (Autodesk.AutoCAD.Runtime.Exception) { idPViewStyle = Prof_Style.getProfileViewStyle("Standard"); idPViewBandSetStyle = Prof_Style.getProfileViewBandSetStyle("Standard"); } PromptStatus ps = default(PromptStatus); Point3d pnt3dIns = default(Point3d); try { pnt3dIns = UserInput.getPoint("Select insertion point for Profile View", out ps, osMode: 0); } catch (Autodesk.AutoCAD.Runtime.Exception) { idAlign.delete(); return(ObjectId.Null); } string strLayer = string.Format("{0}-PROFILEVIEW", Align.getAlignName(idAlign)); Layer.manageLayers(strLayer); Debug.Print("CreateProfileView - Line 74"); ProfileView objProfileView = null; using (BaseObjs._acadDoc.LockDocument()) { using (Transaction TR = BaseObjs.startTransactionDb()) { objProfileView = Prof.addProfileView(idAlign, pnt3dIns, idPViewBandSetStyle, idPViewStyle); TR.Commit(); } } TypedValue[] tvs = new TypedValue[2] { new TypedValue(1001, "WALLDESIGN"), new TypedValue(1005, objProfileView.Handle) }; objProfileView.ObjectId.setXData(tvs, "WALLDESIGN"); Profile objProfile = Prof.getProfile(idAlign, "EXIST"); Prof_Style.removeProfileLabelGroup(objProfileView.ObjectId, objProfile.ObjectId); Debug.Print("CreateProfileView - Line 113"); List <POI> varPOI = new List <POI>(); BlockTableRecord btrMS = null; if (fWall1.opt1_PL.Checked == true) { try { btrMS = xRef.getXRefMSpace("TOPO"); if ((btrMS == null)) { System.Windows.Forms.MessageBox.Show("TOPO drawing not attached"); return(ObjectId.Null); } } catch (Autodesk.AutoCAD.Runtime.Exception) { System.Windows.Forms.MessageBox.Show("TOPO drawing not attached"); return(ObjectId.Null); } if (fWall1.opt1_SurfaceExist.Checked == true) { if (wne.getNestedPoints(idAlign, ref varPOI, btrMS, "WALLDESIGN")) { dynamic sta = from poi in varPOI orderby poi.Station select poi; List <POI> p = new List <POI>(); foreach (var s in sta) { p.Add(s); } varPOI = p; wup.updateProfile(idAlign, varPOI, "EXIST", true, "WALLDESIGN"); } } Debug.Print("CreateProfileView - Line 145"); if (fWall1.opt1_SurfaceDesign.Checked == true) { if (BaseObjs._acadDoc.Name.Contains("GCAL")) { if (wdp.getDesignPoints(idAlign, ref varPOI, "BOTH")) { dynamic sta = from poi in varPOI orderby poi.Station select poi; List <POI> t = new List <POI>(); foreach (var s in sta) { t.Add(s); } varPOI = t; wup.updateProfile(idAlign, varPOI, "CPNT", true, "WALLDESIGN"); } } else { try { btrMS = xRef.getXRefMSpace("GCAL"); if ((btrMS == null)) { System.Windows.Forms.MessageBox.Show("TOPO drawing not attached"); return(ObjectId.Null); } } catch (Autodesk.AutoCAD.Runtime.Exception) { System.Windows.Forms.MessageBox.Show("TOPO drawing not attached"); return(ObjectId.Null); } if (wne.getNestedPoints(idAlign, ref varPOI, btrMS, "WALLDESIGN")) { dynamic sta = from poi in varPOI orderby poi.Station select poi; List <POI> t = new List <POI>(); foreach (var s in sta) { t.Add(s); } varPOI = t; wup.updateProfile(idAlign, varPOI, "CPNT", true, "WALLDESIGN"); } } } } else if (fWall1.opt1_SITE.Checked == true) { if (BaseObjs._acadDoc.Name.Contains("GCAL")) { varPOI = new List <POI>(); if (wdp.getDesignPoints(idAlign, ref varPOI, "LEFT")) { dynamic sta = from poi in varPOI orderby poi.Station select poi; List <POI> t = new List <POI>(); foreach (var s in sta) { t.Add(s); } varPOI = t; wup.updateProfile(idAlign, varPOI, "CPNT", true, "WALLDESIGN"); } if (wdp.getDesignPoints(idAlign, ref varPOI, "RIGHT")) { dynamic sta = from poi in varPOI orderby poi.Station select poi; List <POI> t = new List <POI>(); foreach (var s in sta) { t.Add(s); } varPOI = t; wup.updateProfile(idAlign, varPOI, "CPNT", true, "WALLDESIGN"); } } else { try { btrMS = xRef.getXRefMSpace("TOPO"); if ((btrMS == null)) { System.Windows.Forms.MessageBox.Show("TOPO drawing not attached"); return(ObjectId.Null); } } catch (Autodesk.AutoCAD.Runtime.Exception) { System.Windows.Forms.MessageBox.Show("TOPO drawing not attached"); return(ObjectId.Null); } varPOI = new List <POI>(); if (wne.getNestedPoints(idAlign, ref varPOI, btrMS, "WALLDESIGN")) { dynamic sta = from poi in varPOI orderby poi.Station select poi; List <POI> t = new List <POI>(); foreach (var s in sta) { t.Add(s); } varPOI = t; wup.updateProfile(idAlign, varPOI, "CPNT", true, "WALLDESIGN"); } } } return(objProfileView.ObjectId); }