private void btn_addFcrNote_Click(object sender, EventArgs e) { bool complete = false; resetForm(); ReinforcementBase usrReinforcement = getSingleObjectFromSelection <ReinforcementBase>() as ReinforcementBase; if (usrReinforcement == null) { usrReinforcement = getSingleObjectFromUser <ReinforcementBase>() as ReinforcementBase; } if (usrReinforcement != null) { var(usrPoint, usrView) = getPointFromUser(); if (usrPoint != null) { addFCRNote(usrView, usrPoint, usrReinforcement); complete = true; } } if (!complete) { lbl_info.Text = "Action interrupted."; } }
private void btn_read_Click(object sender, EventArgs e) { resetForm(); ReinforcementBase dwgRebar = getSingleObjectFromSelection <ReinforcementBase>() as ReinforcementBase; if (dwgRebar == null) { dwgRebar = getSingleObjectFromUser <ReinforcementBase>() as ReinforcementBase; } List <string> barInfo = new List <string>(); if (dwgRebar != null) { barInfo = readBarInformation(dwgRebar); } if (barInfo != null) { txtb_phase.Text = barInfo[0]; txtb_barmark.Text = barInfo[1]; } else { lbl_info.Text = "Please select one bar"; } }
private string getPhaseNameFromReinforcement(ReinforcementBase drawingObject) { TSDrg.ReinforcementBase dwgRebar = drawingObject as TSDrg.ReinforcementBase; TSM.Model MyModel = new TSM.Model(); TSM.ModelObject modelRebar = MyModel.SelectModelObject(dwgRebar.ModelIdentifier); TSM.Phase rebarPhase = new TSM.Phase(); modelRebar.GetPhase(out rebarPhase); return(rebarPhase.PhaseName); }
private void addFCRNote(ViewBase view, TSG.Point insertionPoint, ReinforcementBase rebarObject) { string fcrNumber = getPhaseNameFromReinforcement(rebarObject); fcrNumber = fcrNumber.Trim(); if (fcrNumber.LastIndexOf(" ") > 0) { fcrNumber = fcrNumber.Substring(0, fcrNumber.LastIndexOf(" ", fcrNumber.Length)); } TSDrg.Text fcrNote = new TSDrg.Text(view, insertionPoint, fcrNumber, new TSDrg.Text.TextAttributes(PS.Default.usr_FcrNote)); fcrNote.Insert(); view.GetDrawing().CommitChanges(); }
private List <string> readBarInformation(ReinforcementBase dwgRebar) { List <string> info = new List <string>(); TSM.Model MyModel = new TSM.Model(); TSM.ModelObject modelRebar = MyModel.SelectModelObject(dwgRebar.ModelIdentifier); TSM.Phase rebarPhase = new TSM.Phase(); modelRebar.GetPhase(out rebarPhase); info.Add(rebarPhase.PhaseName); string shapeCode = null; bool gotProperty = modelRebar.GetReportProperty("REBAR_POS", ref shapeCode); info.Add(shapeCode); return(info); }