public override bool Run(List <InputDefinition> inputs) { try { ViewBase view = InputDefinitionFactory.GetView(inputs[0]); PointList points = InputDefinitionFactory.GetPoints(inputs[0]); tsg.Point p1 = points[0] as tsg.Point; tsg.Point p2 = points[1] as tsg.Point; // default data #region Default data if (!IsDefaultValue(data.height)) { height = data.height; } if (!IsDefaultValue(data.shop)) { height = data.shop; } if (!IsDefaultValue(data.tw)) { try { tw = (TypeWeld)Enum.Parse(typeof(TypeWeld), data.tw); } catch { } } #endregion #region Drawing double dx = (shop == 1 ? 5 : 8); Line lineArrow = RLine(view, p1, p2, true); lineArrow.Insert(); Line lineCen = RLine(view, p2, new tsg.Point((p2).X + dx, (p2).Y)); lineCen.Insert(); Line lineTop = RLine(view, new tsg.Point((p2).X + dx, (p2).Y), new tsg.Point((p2).X + dx + height, (p2).Y + height)); lineTop.Insert(); Line lineBottom = RLine(view, new tsg.Point((p2).X + dx, (p2).Y), new tsg.Point((p2).X + dx + height, (p2).Y - height)); lineBottom.Insert(); Text t = new Text(view, new tsg.Point((p2).X + dx + 5, (p2).Y), tw.ToString()); t.Attributes.Alignment = TextAlignment.Left; t.Attributes.ArrowHead.Head = ArrowheadTypes.NoArrow; t.Attributes.ArrowHead.ArrowPosition = ArrowheadPositions.None; t.Attributes.ArrowHead.Height = 0; t.Attributes.ArrowHead.Width = 0; t.Placing = PlacingTypes.PointPlacing(); t.Attributes.Frame.Type = FrameTypes.None; t.Attributes.Font.Color = col; t.Attributes.Font.Height = height; t.Insert(); if (shop != 0) { Line LineErection = RLine(view, p2, new tsg.Point((p2).X, (p2).Y + 5)); LineErection.Insert(); PointList pl = new PointList(); pl.Add(LineErection.EndPoint); pl.Add(new tsg.Point(LineErection.EndPoint.X + height, LineErection.EndPoint.Y - 0.5)); pl.Add(new tsg.Point(LineErection.EndPoint.X, LineErection.EndPoint.Y - 1)); Polygon Erection = GetTriangle(view, pl, true); Erection.Insert(); } #region Type Weld Polygon triangle_top = GetTriangle(view, new tsg.Point(lineCen.StartPoint.X + (dx - 4), lineCen.StartPoint.Y)); Polygon triangle_bottom = GetTriangle(view, new tsg.Point(lineCen.StartPoint.X + (dx - 4), lineCen.StartPoint.Y), true); Line doule_line_1 = RLine(view, new tsg.Point(lineCen.StartPoint.X + (dx - 4), lineCen.StartPoint.Y), new tsg.Point(lineCen.StartPoint.X + (dx - 4), lineCen.StartPoint.Y + height)); Line doule_line_2 = RLine(view, new tsg.Point(lineCen.StartPoint.X + (dx - 4) + 1.5, lineCen.StartPoint.Y), new tsg.Point(lineCen.StartPoint.X + (dx - 4) + 1.5, lineCen.StartPoint.Y + height)); Line dl_line_45 = RLine(view, new tsg.Point(lineCen.StartPoint.X + (dx - 4), lineCen.StartPoint.Y), new tsg.Point(lineCen.StartPoint.X + (dx - 4) + height, lineCen.StartPoint.Y + height)); Arc arc = new Arc(view, new tsg.Point(lineCen.StartPoint.X + height, lineCen.StartPoint.Y), lineCen.StartPoint, height * 0.5); arc.Attributes.Line.Color = col; arc.Attributes.Arrowhead.ArrowPosition = ArrowheadPositions.None; arc.Attributes.Line.Type = LineTypes.SolidLine; if (tw == TypeWeld.T1 || tw == TypeWeld.U4 || tw == TypeWeld.H1) { triangle_top.Insert(); } else if (tw == TypeWeld.T3 || tw == TypeWeld.H2) { triangle_top.Insert(); triangle_bottom.Insert(); } else if (tw == TypeWeld.C2) { doule_line_1.Insert(); doule_line_2.Insert(); } else if (tw == TypeWeld.T6 || tw == TypeWeld.U6) { doule_line_1.Insert(); dl_line_45.Insert(); } else if (tw == TypeWeld.T7 || tw == TypeWeld.U7) { doule_line_1.Insert(); dl_line_45.Insert(); arc.Insert(); } #endregion #endregion } catch (Exception Exc) { MessageBox.Show(Exc.ToString()); } return(true); }
public void Modify(PropertyValueChangedEventArgs e) { string label = e.ChangedItem.Label; Drawing drawing = drawingHandler.GetActiveDrawing(); DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected(); while (drawingObjectEnum.MoveNext()) { if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Symbol) { Tekla.Structures.Drawing.Symbol drawingSymbol = (Tekla.Structures.Drawing.Symbol)drawingObjectEnum.Current; if (label == "Angle") drawingSymbol.Attributes.Angle = double.Parse(angle); if (label == "Colour") drawingSymbol.Attributes.Color = colour; if (label == "FrameColour") drawingSymbol.Attributes.Frame.Color = frameColour; if (label == "FrameType") drawingSymbol.Attributes.Frame.Type = (FrameTypes)Enum.Parse(typeof(FrameTypes), frameType.ToString()); if (label == "SymbolHeight") drawingSymbol.Attributes.Height = double.Parse(height); if (label == "PlacingType") { if (placingType == PlacingTypeEnum.PointPlacing) drawingSymbol.Placing = PlacingTypes.PointPlacing(); else if (placingType == PlacingTypeEnum.LeaderLinePlacing) drawingSymbol.Placing = PlacingTypes.LeaderLinePlacing(drawingSymbol.InsertionPoint); } if (label == "SymbolFile") drawingSymbol.SymbolInfo.SymbolFile = symbolFile; if (label == "SymbolIndex") drawingSymbol.SymbolInfo.SymbolIndex = int.Parse(symbolIndex); drawingSymbol.Modify(); drawing.CommitChanges(); } } }