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 DrawDeformations(CombinableList<NodeDeformation> defs) { double maxDef = 0; foreach (NodeDeformation def in defs) { maxDef = Math.Max(maxDef, Math.Abs(def.UX)); maxDef = Math.Max(maxDef, Math.Abs(def.UZ)); } double deformationScale = mCurrentSection.SectionProperties.OuterHeight / 10 / maxDef; // Draw frames foreach (Frame f in mCurrentSection.AnalysisModel.Frames) { float x1 = (float)(f.NodeI.X + defs[f.NodeI.Index].UX * deformationScale); float y1 = (float)(f.NodeI.Z + defs[f.NodeI.Index].UZ * deformationScale); float x2 = (float)(f.NodeJ.X + defs[f.NodeJ.Index].UX * deformationScale); float y2 = (float)(f.NodeJ.Z + defs[f.NodeJ.Index].UZ * deformationScale); SimpleCAD.Line line = new SimpleCAD.Line(x1, y1, x2, y2); line.OutlineStyle = new SimpleCAD.OutlineStyle(FormWorkColor); Model.Add(line); } }
private void DrawCulvertFrame() { float wo = mCurrentSection.SectionProperties.OuterWidth - mCurrentSection.SectionProperties.OuterWallThickness; float ho = mCurrentSection.SectionProperties.OuterHeight - mCurrentSection.SectionProperties.SlabThickness / 2 - mCurrentSection.SectionProperties.FoundationThickness / 2; float x = -wo / 2; float iw = mCurrentSection.SectionProperties.InnerWalls; float dx = wo / (iw + 1); SimpleCAD.Rectangle outer = new SimpleCAD.Rectangle(-wo / 2, 0, wo / 2, ho); outer.OutlineStyle = new SimpleCAD.OutlineStyle(FormWorkColor); Model.Add(outer); for (int i = 0; i < iw; i++) { x += dx; SimpleCAD.Line inner = new SimpleCAD.Line(x, 0, x, ho); inner.OutlineStyle = new SimpleCAD.OutlineStyle(FormWorkColor); Model.Add(inner); } }
private void DrawAnalysisModel(Color color, bool showNodes, bool showSprings) { // Draw frames foreach (Frame f in mCurrentSection.AnalysisModel.Frames) { SimpleCAD.Line line = new SimpleCAD.Line((float)f.NodeI.X, (float)f.NodeI.Z, (float)f.NodeJ.X, (float)f.NodeJ.Z); line.OutlineStyle = new SimpleCAD.OutlineStyle(color, 0, DashStyle.Dash); Model.Add(line); } // Draw nodes if (showNodes) { float nodeSize = 0.5f * TextSize; foreach (Node n in mCurrentSection.AnalysisModel.Nodes) { SimpleCAD.Ellipse ellipse = new SimpleCAD.Ellipse((float)n.X - nodeSize / 2, (float)n.Z - nodeSize / 2, (float)n.X + nodeSize / 2, (float)n.Z + nodeSize / 2); ellipse.OutlineStyle = new SimpleCAD.OutlineStyle(color, 0, DashStyle.Solid); if (n.Restraints != DOF.Free) { ellipse.FillStyle = new SimpleCAD.FillStyle(color); } Model.Add(ellipse); } } // Draw springs if (showSprings) { foreach (Spring s in mCurrentSection.AnalysisModel.Springs) { SimpleCAD.Line line = new SimpleCAD.Line((float)s.NodeI.X, (float)s.NodeI.Z, (float)s.NodeJ.X, (float)s.NodeJ.Z); line.OutlineStyle = new SimpleCAD.OutlineStyle(color, 0); Model.Add(line); } } }
private void DrawRackingLoad() { float wo = mCurrentSection.SectionProperties.OuterWidth - mCurrentSection.SectionProperties.OuterWallThickness; float ho = mCurrentSection.SectionProperties.OuterHeight - mCurrentSection.SectionProperties.SlabThickness / 2 - mCurrentSection.SectionProperties.FoundationThickness / 2; float dx = ho / 10; float ix = -wo / 2; float iw = mCurrentSection.SectionProperties.InnerWalls; float dix = wo / (iw + 1); float supportSize = DimensionOffset; // Left SimpleCAD.Triangle leftSupport = new SimpleCAD.Triangle(-wo / 2, 0, -wo / 2 - supportSize / 2, -supportSize, -wo / 2 + supportSize / 2, -supportSize); leftSupport.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(leftSupport); // Right SimpleCAD.Triangle rightSupport = new SimpleCAD.Triangle(wo / 2, 0, wo / 2 - supportSize / 2, -supportSize, wo / 2 + supportSize / 2, -supportSize); rightSupport.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(rightSupport); // Deformed shape PointF[] deformed = new PointF[4]; deformed[0] = new PointF(-wo / 2, 0); deformed[1] = new PointF(wo / 2, 0); deformed[2] = new PointF(wo / 2 + dx, ho); deformed[3] = new PointF(-wo / 2 + dx, ho); SimpleCAD.Polygon deformedObj = new SimpleCAD.Polygon(deformed); deformedObj.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor, 3); Model.Add(deformedObj); for (int i = 0; i < iw; i++) { ix += dix; SimpleCAD.Line deformedWall = new SimpleCAD.Line(ix, 0, ix + dx, ho); deformedWall.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor, 3); Model.Add(deformedWall); } // Text float textOffset = DimensionOffset; float x = wo / 2 + dx + textOffset; float y = ho; string[] text = new string[]{ "Racking Parameters:", mCurrentSection.SoilParameters.PGA.ToString("PGA = 0.00 g"), mCurrentSection.SoilParameters.DepthToInvertLevel.ToString("z = 0.00 m"), mCurrentSection.SoilParameters.StressAtInvertLevel.ToString("σz = 0.00 kPa"), mCurrentSection.SoilParameters.StressReductionFactor.ToString("Rd = 0.00"), mCurrentSection.SoilParameters.MaximumShearStress.ToString("τ = 0.00 kPa"), mCurrentSection.SoilParameters.MaximumShearStrain.ToString("γ = 0.0000"), mCurrentSection.SoilParameters.FreeFieldDeformation.ToString("Δ = 0.0000 m")}; SimpleCAD.MultiLineText rackingParamsText = new SimpleCAD.MultiLineText(x, y, text, TextSize); rackingParamsText.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); rackingParamsText.FontFamily = Font.Name; Model.Add(rackingParamsText); }
private void DrawInternalForce(Frame f, float minForceI, float minForceJ, float maxForceI, float maxForceJ, 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); Color envelopeColor = Color.FromArgb(fillAlpha, EnvelopeForceColor); float minLoadx1 = x1 + (float)(minForceI * scale * Math.Cos(loadOrientation)); float minLoady1 = y1 + (float)(minForceI * scale * Math.Sin(loadOrientation)); float minLoadx2 = x2 + (float)(minForceJ * scale * Math.Cos(loadOrientation)); float minLoady2 = y2 + (float)(minForceJ * scale * Math.Sin(loadOrientation)); float maxLoadx1 = x1 + (float)(maxForceI * scale * Math.Cos(loadOrientation)); float maxLoady1 = y1 + (float)(maxForceI * scale * Math.Sin(loadOrientation)); float maxLoadx2 = x2 + (float)(maxForceJ * scale * Math.Cos(loadOrientation)); float maxLoady2 = y2 + (float)(maxForceJ * scale * Math.Sin(loadOrientation)); SimpleCAD.Polygon range = new SimpleCAD.Polygon(new PointF[] { new PointF(minLoadx1, minLoady1), new PointF(minLoadx2, minLoady2), new PointF(maxLoadx2, maxLoady2), new PointF(maxLoadx1, maxLoady1) }); range.OutlineStyle = new SimpleCAD.OutlineStyle(Color.Transparent); range.FillStyle = new SimpleCAD.FillStyle(envelopeColor); Model.Add(range); if (minForceI < 0 && maxForceI < 0 && minForceI < 0 && minForceJ < 0) { SimpleCAD.Polygon poly = new SimpleCAD.Polygon(new PointF[] { new PointF(maxLoadx1, maxLoady1), new PointF(maxLoadx2, maxLoady2), new PointF(x2, y2), new PointF(x1, y1) }); poly.OutlineStyle = new SimpleCAD.OutlineStyle(Color.Transparent); poly.FillStyle = new SimpleCAD.FillStyle(negativeColor); Model.Add(poly); } else if (minForceI > 0 && maxForceI > 0 && minForceI > 0 && minForceJ > 0) { SimpleCAD.Polygon poly = new SimpleCAD.Polygon(new PointF[] { new PointF(minLoadx1, minLoady1), new PointF(minLoadx2, minLoady2), new PointF(x2, y2), new PointF(x1, y1) }); poly.OutlineStyle = new SimpleCAD.OutlineStyle(Color.Transparent); poly.FillStyle = new SimpleCAD.FillStyle(positiveColor); Model.Add(poly); } SimpleCAD.Line line1 = new SimpleCAD.Line(minLoadx1, minLoady1, minLoadx2, minLoady2); line1.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(line1); SimpleCAD.Line line2 = new SimpleCAD.Line(maxLoadx1, maxLoady1, maxLoadx2, maxLoady2); line2.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(line2); SimpleCAD.Line line3 = new SimpleCAD.Line(x1, y1, x2, y2); line3.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(line3); SimpleCAD.Line line4 = new SimpleCAD.Line(minLoadx1, minLoady1, x1, y1); line4.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(line4); SimpleCAD.Line line5 = new SimpleCAD.Line(minLoadx2, minLoady2, x2, y2); line5.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(line5); SimpleCAD.Line line6 = new SimpleCAD.Line(maxLoadx1, maxLoady1, x1, y1); line6.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(line6); SimpleCAD.Line line7 = new SimpleCAD.Line(maxLoadx2, maxLoady2, x2, y2); line7.OutlineStyle = new SimpleCAD.OutlineStyle(DimensionColor); Model.Add(line7); }