private void DrawFrameNumbers() { float textOffset = 0.5f * TextSize; foreach (Frame f in mCurrentSection.AnalysisModel.Frames) { float angle = (float)f.Angle * 180 / (float)Math.PI; float x = (float)f.Centroid.X - textOffset * 1.5f * (float)Math.Sin(angle * Math.PI / 180.0); float y = (float)f.Centroid.Z + textOffset * 1.5f * (float)Math.Cos(angle * Math.PI / 180.0); SimpleCAD.Text text = new SimpleCAD.Text(x, y, (f.Index + 1).ToString(), TextSize); text.HorizontalAlignment = StringAlignment.Center; text.VerticalAlignment = StringAlignment.Center; text.Rotation = angle; text.FontFamily = Font.Name; text.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(text); } }
private void DrawInternalForce(Frame f, float forceI, float forceJ, float scale) { float x1 = (float)f.NodeI.X; float y1 = (float)f.NodeI.Z; float x2 = (float)f.NodeJ.X; float y2 = (float)f.NodeJ.Z; float orientation = (float)f.Angle; float loadOrientation = orientation + (float)Math.PI / 2; float textAngle = orientation * 180 / (float)Math.PI + 90; int fillAlpha = (int)((1 - mFillTransparency) * 255); Color negativeColor = Color.FromArgb(fillAlpha, NegativeForceColor); Color positiveColor = Color.FromArgb(fillAlpha, PositiveForceColor); float loadx1 = x1 + (float)(forceI * scale * Math.Cos(loadOrientation)); float loady1 = y1 + (float)(forceI * scale * Math.Sin(loadOrientation)); float loadx2 = x2 + (float)(forceJ * scale * Math.Cos(loadOrientation)); float loady2 = y2 + (float)(forceJ * scale * Math.Sin(loadOrientation)); if ((Math.Abs(forceI - forceJ) < float.Epsilon) || (Math.Sign(forceI) * Math.Sign(forceJ) > 0)) { SimpleCAD.Polygon poly = new SimpleCAD.Polygon(new PointF[] { new PointF(x1, y1), new PointF(x2, y2), new PointF(loadx2, loady2), new PointF(loadx1, loady1) }); poly.OutlineStyle = new SimpleCAD.OutlineStyle(Color.Transparent); poly.FillStyle = new SimpleCAD.FillStyle(forceI < 0 ? negativeColor : positiveColor); Model.Add(poly); } else { float xmid = Math.Abs(forceI) / Math.Abs(forceI - forceJ) * (x2 - x1) + x1; float ymid = Math.Abs(forceI) / Math.Abs(forceI - forceJ) * (y2 - y1) + y1; SimpleCAD.Polygon polyI = new SimpleCAD.Polygon(new PointF[] { new PointF(x1, y1), new PointF(xmid, ymid), new PointF(loadx1, loady1) }); polyI.OutlineStyle = new SimpleCAD.OutlineStyle(Color.Transparent); polyI.FillStyle = new SimpleCAD.FillStyle(forceI < 0 ? negativeColor : positiveColor); Model.Add(polyI); SimpleCAD.Polygon polyJ = new SimpleCAD.Polygon(new PointF[] { new PointF(xmid, ymid), new PointF(x2, y2), new PointF(loadx2, loady2) }); polyJ.OutlineStyle = new SimpleCAD.OutlineStyle(Color.Transparent); polyJ.FillStyle = new SimpleCAD.FillStyle(forceJ < 0 ? negativeColor : positiveColor); Model.Add(polyJ); } SimpleCAD.Line line1 = new SimpleCAD.Line(x1, y1, loadx1, loady1); line1.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(line1); SimpleCAD.Line line2 = new SimpleCAD.Line(x2, y2, loadx2, loady2); line2.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(line2); SimpleCAD.Line line3 = new SimpleCAD.Line(loadx1, loady1, loadx2, loady2); line3.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(line3); SimpleCAD.Line line4 = new SimpleCAD.Line(x1, y1, x2, y2); line4.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(line4); SimpleCAD.Text textI = new SimpleCAD.Text(loadx1, loady1, forceI.ToString("0.0"), TextSize); textI.HorizontalAlignment = StringAlignment.Near; textI.VerticalAlignment = StringAlignment.Center; textI.Rotation = textAngle; textI.FontFamily = Font.Name; textI.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(textI); SimpleCAD.Text textJ = new SimpleCAD.Text(loadx2, loady2, forceJ.ToString("0.0"), TextSize); textJ.HorizontalAlignment = StringAlignment.Near; textJ.VerticalAlignment = StringAlignment.Center; textJ.Rotation = textAngle; textJ.FontFamily = Font.Name; textJ.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(textJ); }
private void DrawEarthFillLoad() { float loadOffset = DimensionOffset; // Load scale float maxLoadSize = 2 * loadOffset; float maxLoad = Math.Max(mCurrentSection.SoilParameters.FillLoad, mCurrentSection.SoilParameters.SoilPressureBottom); // Dimensions float wi = mCurrentSection.SectionProperties.InnerWidth; float hi = mCurrentSection.SectionProperties.InnerHeight; float tw = mCurrentSection.SectionProperties.OuterWallThickness; float tf = mCurrentSection.SectionProperties.FoundationThickness; float ts = mCurrentSection.SectionProperties.SlabThickness; float w = mCurrentSection.SectionProperties.OuterWidth - tw; float h = hi + tf / 2 + ts / 2; // Earth fill float earthFillScale = mCurrentSection.SoilParameters.FillLoad / maxLoad * maxLoadSize; PointF[] earthFill = new PointF[4]; earthFill[0] = new PointF(-w / 2, h + loadOffset); earthFill[1] = new PointF(w / 2, h + loadOffset); earthFill[2] = new PointF(w / 2, h + loadOffset + earthFillScale); earthFill[3] = new PointF(-w / 2, h + loadOffset + earthFillScale); SimpleCAD.Polygon load = new SimpleCAD.Polygon(earthFill); load.OutlineStyle = new SimpleCAD.OutlineStyle(LoadColor); load.FillStyle = new SimpleCAD.FillStyle(LoadColor, ShadingColor, HatchStyle.LightVertical); Model.Add(load); float x = -w / 2; float y = h + loadOffset + earthFillScale + loadOffset / 2; string text = mCurrentSection.SoilParameters.FillLoad.ToString("EV = 0.00 kPa"); SimpleCAD.Text loadText = new SimpleCAD.Text(x, y, text, TextSize); loadText.HorizontalAlignment = StringAlignment.Near; loadText.VerticalAlignment = StringAlignment.Center; loadText.FontFamily = Font.Name; loadText.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(loadText); }
private void DrawFrameLoads(AnalysisCase analysisCase) { float maxLoadSize = 10 * DimensionOffset; float textOffset = 0.5f * TextSize; float maxLoad = 0; foreach (Frame f in mCurrentSection.AnalysisModel.Frames) { foreach (FrameLoad load in f.Loads.FindAll((e) => e.AnalysisCase == analysisCase)) { if (load is FrameUniformLoad) { FrameUniformLoad uniformLoad = load as FrameUniformLoad; maxLoad = (float)Math.Max(maxLoad, Math.Max(Math.Abs(uniformLoad.FX), Math.Abs(uniformLoad.FZ))); } if (load is FrameTrapezoidalLoad) { FrameTrapezoidalLoad trapezoidalLoad = load as FrameTrapezoidalLoad; maxLoad = (float)Math.Max(maxLoad, Math.Max(Math.Abs(trapezoidalLoad.FXI), Math.Abs(trapezoidalLoad.FZI))); maxLoad = (float)Math.Max(maxLoad, Math.Max(Math.Abs(trapezoidalLoad.FXJ), Math.Abs(trapezoidalLoad.FZJ))); } } } foreach (Frame f in mCurrentSection.AnalysisModel.Frames) { float x1 = (float)f.NodeI.X; float y1 = (float)f.NodeI.Z; float x2 = (float)f.NodeJ.X; float y2 = (float)f.NodeJ.Z; float angle = (float)f.Angle * 180 / (float)Math.PI + 90; foreach (FrameLoad load in f.Loads.FindAll((e) => e.AnalysisCase == analysisCase)) { if (load is FrameUniformLoad) { FrameUniformLoad uniformLoad = load as FrameUniformLoad; float loadx1 = x1 - (float)uniformLoad.FX * maxLoadSize / maxLoad; float loady1 = y1 - (float)uniformLoad.FZ * maxLoadSize / maxLoad; float loadx2 = x2 - (float)uniformLoad.FX * maxLoadSize / maxLoad; float loady2 = y2 - (float)uniformLoad.FZ * maxLoadSize / maxLoad; SimpleCAD.Polygon poly = new SimpleCAD.Polygon(new PointF[] { new PointF(x1, y1), new PointF(x2, y2), new PointF(loadx2, loady2), new PointF(loadx1, loady1) }); poly.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); poly.FillStyle = new SimpleCAD.FillStyle(ShadingColor); Model.Add(poly); SimpleCAD.Text text = new SimpleCAD.Text(loadx1, loady1, uniformLoad.FX.ToString("0.0") + ", " + uniformLoad.FZ.ToString("0.0"), TextSize); text.HorizontalAlignment = StringAlignment.Near; text.VerticalAlignment = StringAlignment.Center; text.Rotation = angle; text.FontFamily = Font.Name; text.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(text); } if (load is FrameTrapezoidalLoad) { FrameTrapezoidalLoad trapezoidalLoad = load as FrameTrapezoidalLoad; float loadx1 = x1 - (float)trapezoidalLoad.FXI * maxLoadSize / maxLoad; float loady1 = y1 - (float)trapezoidalLoad.FZI * maxLoadSize / maxLoad; float loadx2 = x2 - (float)trapezoidalLoad.FXJ * maxLoadSize / maxLoad; float loady2 = y2 - (float)trapezoidalLoad.FZJ * maxLoadSize / maxLoad; SimpleCAD.Polygon poly = new SimpleCAD.Polygon(new PointF[] { new PointF(x1, y1), new PointF(x2, y2), new PointF(loadx2, loady2), new PointF(loadx1, loady1) }); poly.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); poly.FillStyle = new SimpleCAD.FillStyle(ShadingColor); Model.Add(poly); SimpleCAD.Text textI = new SimpleCAD.Text(loadx1, loady1, trapezoidalLoad.FXI.ToString("0.0") + ", " + trapezoidalLoad.FZI.ToString("0.0"), TextSize); textI.HorizontalAlignment = StringAlignment.Near; textI.VerticalAlignment = StringAlignment.Center; textI.Rotation = angle; textI.FontFamily = Font.Name; textI.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(textI); SimpleCAD.Text textJ = new SimpleCAD.Text(loadx2, loady2, trapezoidalLoad.FXJ.ToString("0.0") + ", " + trapezoidalLoad.FZJ.ToString("0.0"), TextSize); textJ.HorizontalAlignment = StringAlignment.Near; textJ.VerticalAlignment = StringAlignment.Center; textJ.Rotation = angle; textJ.FontFamily = Font.Name; textJ.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(textJ); } } } }
private void DrawSurchargeLoad() { float loadOffset = DimensionOffset; // Load scale float maxLoadSize = 2 * loadOffset; // Dimensions float wi = mCurrentSection.SectionProperties.InnerWidth; float hi = mCurrentSection.SectionProperties.InnerHeight; float tw = mCurrentSection.SectionProperties.OuterWallThickness; float tf = mCurrentSection.SectionProperties.FoundationThickness; float ts = mCurrentSection.SectionProperties.SlabThickness; float w = mCurrentSection.SectionProperties.OuterWidth - tw; float h = hi + tf / 2 + ts / 2; // Surcharge left PointF[] surchargeLeft = new PointF[4]; surchargeLeft[0] = new PointF(-w / 2 - loadOffset - maxLoadSize, 0); surchargeLeft[1] = new PointF(-w / 2 - loadOffset, 0); surchargeLeft[2] = new PointF(-w / 2 - loadOffset, h); surchargeLeft[3] = new PointF(-w / 2 - loadOffset - maxLoadSize, h); SimpleCAD.Polygon loadLeft = new SimpleCAD.Polygon(surchargeLeft); loadLeft.OutlineStyle = new SimpleCAD.OutlineStyle(LoadColor); loadLeft.FillStyle = new SimpleCAD.FillStyle(LoadColor, ShadingColor, HatchStyle.LightHorizontal); Model.Add(loadLeft); SimpleCAD.Text loadTextLeft = new SimpleCAD.Text(-w / 2 - loadOffset, h + loadOffset / 4, mCurrentSection.SoilParameters.SurchargeLoad.ToString("ES = 0.00 kPa"), TextSize); loadTextLeft.HorizontalAlignment = StringAlignment.Far; loadTextLeft.VerticalAlignment = StringAlignment.Near; loadTextLeft.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); loadTextLeft.FontFamily = Font.Name; Model.Add(loadTextLeft); // Surcharge right PointF[] surchargeRight = new PointF[4]; surchargeRight[0] = new PointF(w / 2 + loadOffset + maxLoadSize, 0); surchargeRight[1] = new PointF(w / 2 + loadOffset, 0); surchargeRight[2] = new PointF(w / 2 + loadOffset, h); surchargeRight[3] = new PointF(w / 2 + loadOffset + maxLoadSize, h); SimpleCAD.Polygon loadRight = new SimpleCAD.Polygon(surchargeRight); loadRight.OutlineStyle = new SimpleCAD.OutlineStyle(LoadColor); loadRight.FillStyle = new SimpleCAD.FillStyle(LoadColor, ShadingColor, HatchStyle.LightHorizontal); Model.Add(loadRight); SimpleCAD.Text loadTextRight = new SimpleCAD.Text(w / 2 + loadOffset, h + loadOffset / 4, mCurrentSection.SoilParameters.SurchargeLoad.ToString("ES = 0.00 kPa"), TextSize); loadTextRight.HorizontalAlignment = StringAlignment.Near; loadTextRight.VerticalAlignment = StringAlignment.Near; loadTextRight.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); loadTextRight.FontFamily = Font.Name; Model.Add(loadTextRight); }
private void DrawSoilPressureLoad() { float loadOffset = DimensionOffset; // Load scale float maxLoadSize = 2 * loadOffset; float maxLoad = Math.Max(mCurrentSection.SoilParameters.FillLoad, mCurrentSection.SoilParameters.SoilPressureBottom); // Dimensions float wi = mCurrentSection.SectionProperties.InnerWidth; float hi = mCurrentSection.SectionProperties.InnerHeight; float tw = mCurrentSection.SectionProperties.OuterWallThickness; float tf = mCurrentSection.SectionProperties.FoundationThickness; float ts = mCurrentSection.SectionProperties.SlabThickness; float w = mCurrentSection.SectionProperties.OuterWidth - tw; float h = hi + tf / 2 + ts / 2; // Earth pressure - left float earthPressureScale1 = mCurrentSection.SoilParameters.SoilPressureTop / maxLoad * maxLoadSize; float earthPressureScale2 = mCurrentSection.SoilParameters.SoilPressureBottom / maxLoad * maxLoadSize; PointF[] earthPressureLeft = new PointF[4]; earthPressureLeft[0] = new PointF(-w / 2 - loadOffset - earthPressureScale2, 0); earthPressureLeft[1] = new PointF(-w / 2 - loadOffset, 0); earthPressureLeft[2] = new PointF(-w / 2 - loadOffset, h); earthPressureLeft[3] = new PointF(-w / 2 - loadOffset - earthPressureScale1, h); SimpleCAD.Polygon loadLeft = new SimpleCAD.Polygon(earthPressureLeft); loadLeft.OutlineStyle = new SimpleCAD.OutlineStyle(LoadColor); loadLeft.FillStyle = new SimpleCAD.FillStyle(LoadColor, ShadingColor, HatchStyle.LightHorizontal); Model.Add(loadLeft); SimpleCAD.Text loadTextLeftTop = new SimpleCAD.Text(-w / 2 - loadOffset, h + loadOffset / 4, mCurrentSection.SoilParameters.SoilPressureTop.ToString("EH = 0.00 kPa"), TextSize); loadTextLeftTop.HorizontalAlignment = StringAlignment.Far; loadTextLeftTop.VerticalAlignment = StringAlignment.Near; loadTextLeftTop.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); loadTextLeftTop.FontFamily = Font.Name; Model.Add(loadTextLeftTop); SimpleCAD.Text loadTextLeftBottom = new SimpleCAD.Text(-w / 2 - loadOffset, -loadOffset / 4, mCurrentSection.SoilParameters.SoilPressureBottom.ToString("EH = 0.00 kPa"), TextSize); loadTextLeftBottom.HorizontalAlignment = StringAlignment.Far; loadTextLeftBottom.VerticalAlignment = StringAlignment.Far; loadTextLeftBottom.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); loadTextLeftBottom.FontFamily = Font.Name; Model.Add(loadTextLeftBottom); // Earth pressure - right PointF[] earthPressureRight = new PointF[4]; earthPressureRight[0] = new PointF(w / 2 + loadOffset + earthPressureScale2, 0); earthPressureRight[1] = new PointF(w / 2 + loadOffset, 0); earthPressureRight[2] = new PointF(w / 2 + loadOffset, h); earthPressureRight[3] = new PointF(w / 2 + loadOffset + earthPressureScale1, h); SimpleCAD.Polygon loadRight = new SimpleCAD.Polygon(earthPressureRight); loadRight.OutlineStyle = new SimpleCAD.OutlineStyle(LoadColor); loadRight.FillStyle = new SimpleCAD.FillStyle(LoadColor, ShadingColor, HatchStyle.LightHorizontal); Model.Add(loadRight); SimpleCAD.Text loadTextRightTop = new SimpleCAD.Text(w / 2 + loadOffset, h + loadOffset / 4, mCurrentSection.SoilParameters.SoilPressureTop.ToString("EH = 0.00 kPa"), TextSize); loadTextRightTop.HorizontalAlignment = StringAlignment.Near; loadTextRightTop.VerticalAlignment = StringAlignment.Near; loadTextRightTop.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); loadTextRightTop.FontFamily = Font.Name; Model.Add(loadTextRightTop); SimpleCAD.Text loadTextRightBottom = new SimpleCAD.Text(w / 2 + loadOffset, -loadOffset / 4, mCurrentSection.SoilParameters.SoilPressureBottom.ToString("EH = 0.00 kPa"), TextSize); loadTextRightBottom.HorizontalAlignment = StringAlignment.Near; loadTextRightBottom.VerticalAlignment = StringAlignment.Far; loadTextRightBottom.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); loadTextRightBottom.FontFamily = Font.Name; Model.Add(loadTextRightBottom); }
private void DrawReactions(CombinableList<Reaction> reactions) { float textOffset = 0.5f * TextSize; foreach (Reaction r in reactions) { string reactionText = r.FX.ToString("0") + ", " + r.FZ.ToString("0") + ", " + r.MY.ToString("0"); SimpleCAD.Text text = new SimpleCAD.Text((float)r.Node.X + textOffset / 2, (float)r.Node.Z + textOffset / 2, reactionText, TextSize); text.FontFamily = Font.Name; text.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(text); } }
private void DrawNodeNumbers() { float textOffset = 0.5f * TextSize; foreach (Node n in mCurrentSection.AnalysisModel.Nodes) { SimpleCAD.Text text = new SimpleCAD.Text((float)n.X + textOffset / 2, (float)n.Z + textOffset / 2, (n.Index + 1).ToString(), TextSize); text.FontFamily = Font.Name; text.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(text); } }
private void DrawNodeLoads(AnalysisCase analysisCase) { float textOffset = 0.5f * TextSize; foreach (Node n in mCurrentSection.AnalysisModel.Nodes) { foreach (NodeLoad load in n.Loads.FindAll((e) => e.AnalysisCase == analysisCase)) { if (load is NodePointLoad) { NodePointLoad pointLoad = load as NodePointLoad; string loadText = pointLoad.FX.ToString("0") + ", " + pointLoad.FZ.ToString("0") + ", " + pointLoad.MY.ToString("0"); SimpleCAD.Text text = new SimpleCAD.Text((float)n.X + textOffset / 2, (float)n.Z + textOffset / 2, loadText, TextSize); text.FontFamily = Font.Name; text.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(text); } } } }