public void GetProperties() { DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected(); if (drawingObjectEnum.GetSize() == 1) { while (drawingObjectEnum.MoveNext()) { if (drawingObjectEnum.Current is Tekla.Structures.Drawing.View) { Tekla.Structures.Drawing.View drawingView = (Tekla.Structures.Drawing.View)drawingObjectEnum.Current; scale = drawingView.Attributes.Scale.ToString("F02"); sizeXMin = drawingView.RestrictionBox.MinPoint.X.ToString("F02"); sizeXMax = drawingView.RestrictionBox.MaxPoint.X.ToString("F02"); sizeYMin = drawingView.RestrictionBox.MinPoint.Y.ToString("F02"); sizeYMax = drawingView.RestrictionBox.MaxPoint.Y.ToString("F02"); sizeDepthDown = Math.Abs(drawingView.RestrictionBox.MinPoint.Z).ToString("F02"); sizeDepthUp = drawingView.RestrictionBox.MaxPoint.Z.ToString("F02"); viewExtension = drawingView.Attributes.ViewExtensionForNeighbourParts.ToString("F02"); if (drawingView.Attributes.FixedViewPlacing) { fixedViewPlacing = Bool.True; } else { fixedViewPlacing = Bool.False; } if (drawingView.Attributes.Shortening.CutParts) { cutParts = Bool.True; } else { cutParts = Bool.False; } minimumLength = drawingView.Attributes.Shortening.MinimumLength.ToString("F02"); } } } else if (drawingObjectEnum.GetSize() > 1) { scale = ""; sizeXMin = ""; sizeXMax = ""; sizeYMin = ""; sizeYMax = ""; sizeDepthDown = ""; sizeDepthUp = ""; viewExtension = ""; fixedViewPlacing = new Bool(); cutParts = new Bool(); minimumLength = ""; } }
public static void Run(Tekla.Technology.Akit.IScript akit) { try { Model model = new Model(); DrawingHandler drawingHandler = new DrawingHandler(); ArrayList ModelObjectArray = new ArrayList(); if (drawingHandler.GetActiveDrawing() != null) { DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected(); if (drawingObjectEnum.GetSize() > 0) { while (drawingObjectEnum.MoveNext()) { Tekla.Structures.Drawing.ModelObject dModelObject = (Tekla.Structures.Drawing.ModelObject)drawingObjectEnum.Current; ModelObjectArray.Add(model.SelectModelObject(dModelObject.ModelIdentifier)); } } Tekla.Structures.Model.UI.ModelObjectSelector modelObjectSelector = new Tekla.Structures.Model.UI.ModelObjectSelector(); modelObjectSelector.Select(ModelObjectArray); } akit.Callback("acmdZoomToSelected", "", "main_frame"); } catch { } }
public static void Run(Tekla.Technology.Akit.IScript akit) { try { Model model = new Model(); DrawingHandler drawingHandler = new DrawingHandler(); DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected(); ArrayList ModelObjectArray = new ArrayList(); if (drawingObjectEnum.GetSize() > 0) { while (drawingObjectEnum.MoveNext()) { if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Part) { Tekla.Structures.Drawing.Part part = drawingObjectEnum.Current as Tekla.Structures.Drawing.Part; ModelObjectArray.Add(model.SelectModelObject(new Identifier(part.ModelIdentifier.ID))); } if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Bolt) { Tekla.Structures.Drawing.Bolt bolt = drawingObjectEnum.Current as Tekla.Structures.Drawing.Bolt; ModelObjectArray.Add(model.SelectModelObject(new Identifier(bolt.ModelIdentifier.ID))); } } } Tekla.Structures.Model.UI.ModelObjectSelector modelObjectSelector = new Tekla.Structures.Model.UI.ModelObjectSelector(); modelObjectSelector.Select(ModelObjectArray); akit.Callback("acmd_display_selected_object_dialog", "", "main_frame"); } catch { } }
/// <summary>Adds items from the enumerator to the System.Collections.Generic.List</summary> public static List <DrawingObject> ToList(this DrawingObjectEnumerator enumerator) { var output = new List <DrawingObject>(enumerator.GetSize()); while (enumerator.MoveNext()) { output.Add(enumerator.Current); } return(output); }
public void GetProperties() { DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected(); if (drawingObjectEnum.GetSize() == 1) { while (drawingObjectEnum.MoveNext()) { if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Bolt) { Tekla.Structures.Drawing.Bolt drawingBolt = (Tekla.Structures.Drawing.Bolt)drawingObjectEnum.Current; boltRepresentation = drawingBolt.Attributes.Representation; if (drawingBolt.Attributes.SymbolContainsAxis) { symbolContainsAxis = Bool.True; } else { symbolContainsAxis = Bool.False; } if (drawingBolt.Attributes.SymbolContainsHole) { symbolContainsHole = Bool.True; } else { symbolContainsHole = Bool.False; } colour = drawingBolt.Attributes.Color; } } } else if (drawingObjectEnum.GetSize() > 1) { boltRepresentation = new Bolt.Representation(); symbolContainsAxis = new Bool(); SymbolContainsHole = new Bool(); colour = new DrawingColors(); } }
public void GetProperties() { DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected(); if (drawingObjectEnum.GetSize() == 1) { while (drawingObjectEnum.MoveNext()) { if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Mark) { Tekla.Structures.Drawing.Mark drawingMark = (Tekla.Structures.Drawing.Mark)drawingObjectEnum.Current; frameColour = drawingMark.Attributes.Frame.Color; frameType = (FrameTypeEnum)Enum.Parse(typeof(FrameTypeEnum), drawingMark.Attributes.Frame.Type.ToString()); } } } else if (drawingObjectEnum.GetSize() > 1) { frameColour = new DrawingColors(); FrameType = new FrameTypeEnum(); } }
public void GetProperties() { DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected(); if (drawingObjectEnum.GetSize() == 1) { while (drawingObjectEnum.MoveNext()) { if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Symbol) { Tekla.Structures.Drawing.Symbol drawingSymbol = (Tekla.Structures.Drawing.Symbol)drawingObjectEnum.Current; angle = drawingSymbol.Attributes.Angle.ToString(); colour = drawingSymbol.Attributes.Color; frameColour = drawingSymbol.Attributes.Frame.Color; frameType = (FrameTypeEnum)Enum.Parse(typeof(FrameTypeEnum), drawingSymbol.Attributes.Frame.Type.ToString()); height = drawingSymbol.Attributes.Height.ToString(); insertionPoint = drawingSymbol.InsertionPoint; string placing = drawingSymbol.Placing.ToString().Replace("Tekla.Structures.Drawing.", ""); placingType = (PlacingTypeEnum)Enum.Parse(typeof(PlacingTypeEnum), placing); symbolFile = drawingSymbol.SymbolInfo.SymbolFile; symbolIndex = drawingSymbol.SymbolInfo.SymbolIndex.ToString(); } } } else if (drawingObjectEnum.GetSize() > 1) { angle = ""; colour = new DrawingColors(); frameColour = new DrawingColors(); frameType = new FrameTypeEnum(); height = ""; insertionPoint = null; placingType = new PlacingTypeEnum(); symbolFile = ""; symbolIndex = ""; } }
/// <summary>Adds items from the enumerator to the System.Collections.Generic.List. if (enumerator.Current is T t) output.Add(t);</summary> public static List <T> ToList <T>(this DrawingObjectEnumerator enumerator) where T : DrawingObject { var output = new List <T>(enumerator.GetSize()); while (enumerator.MoveNext()) { if (enumerator.Current is T t) { output.Add(t); } } return(output); }
public void GetProperties() { DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected(); if (drawingObjectEnum.GetSize() == 1) { while (drawingObjectEnum.MoveNext()) { if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Weld) { Tekla.Structures.Drawing.Weld drawingWeld = (Tekla.Structures.Drawing.Weld)drawingObjectEnum.Current; } } } }
private void UpdateProperties() { if (this.propertyGrid1.InvokeRequired) { UpdatePropertiesCallback d = new UpdatePropertiesCallback(UpdateProperties); this.Invoke(d); } else { Drawing drawing = drawingHandler.GetActiveDrawing(); if (drawing != null) { DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected(); statusLabel.Text = drawingObjectEnum.GetSize().ToString() + " objects selected"; ArrayList arraySelectedObjects = new ArrayList(); if (drawingObjectEnum.GetSize() == 0) { activeDrawing.GetProperties(); propertyGrid1.SelectedObject = activeDrawing; } while (drawingObjectEnum.MoveNext()) { string objectType = drawingObjectEnum.Current.GetType().ToString(); if (!arraySelectedObjects.Contains(objectType)) { arraySelectedObjects.Add(objectType); } } comboBox1.Text = ""; comboBox1.Items.Clear(); arraySelectedObjects.Sort(); foreach (string objectName in arraySelectedObjects) { comboBox1.Items.Add(objectName); } if (arraySelectedObjects.Count == 1) { if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Drawing.Part") { drawingPart.GetProperties(); propertyGrid1.SelectedObject = drawingPart; } else if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Drawing.Weld") { drawingWeld.GetProperties(); propertyGrid1.SelectedObject = drawingWeld; } else if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Drawing.View") { view.GetProperties(); propertyGrid1.SelectedObject = view; } else if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Drawing.Bolt") { drawingBolt.GetProperties(); propertyGrid1.SelectedObject = drawingBolt; } else if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Drawing.StraightDimensionSet") { straightDim.GetProperties(); propertyGrid1.SelectedObject = straightDim; } else if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Drawing.RadiusDimension") { radiusDim.GetProperties(); propertyGrid1.SelectedObject = radiusDim; } else if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Drawing.CurvedDimensionSetRadial") { radialDim.GetProperties(); propertyGrid1.SelectedObject = radialDim; } else if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Drawing.AngleDimension") { angleDim.GetProperties(); propertyGrid1.SelectedObject = angleDim; } else if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Drawing.GridLine") { drawingGrid.GetProperties(); propertyGrid1.SelectedObject = drawingGrid; } else if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Drawing.Line") { line.GetProperties(); propertyGrid1.SelectedObject = line; } else if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Drawing.Arc") { arc.GetProperties(); propertyGrid1.SelectedObject = arc; } else if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Drawing.Polyline") { polyline.GetProperties(); propertyGrid1.SelectedObject = polyline; } else if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Drawing.Rectangle") { rectangle.GetProperties(); propertyGrid1.SelectedObject = rectangle; } else if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Drawing.Circle") { circle.GetProperties(); propertyGrid1.SelectedObject = circle; } else if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Drawing.Polygon") { polygon.GetProperties(); propertyGrid1.SelectedObject = polygon; } else if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Drawing.Text") { text.GetProperties(); propertyGrid1.SelectedObject = text; } else if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Drawing.Symbol") { symbol.GetProperties(); propertyGrid1.SelectedObject = symbol; } else if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Drawing.Mark") { mark.GetProperties(); propertyGrid1.SelectedObject = mark; } else { activeDrawing.GetProperties(); propertyGrid1.SelectedObject = activeDrawing; } comboBox1.SelectedText = arraySelectedObjects[0].ToString(); propertyGrid1.Focus(); } if (arraySelectedObjects.Count > 1) { propertyGrid1.SelectedObject = null; } } if (drawing == null) { ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects(); statusLabel.Text = modelObjectEnum.GetSize().ToString() + " objects selected"; ArrayList arraySelectedObjects = new ArrayList(); if (modelObjectEnum.GetSize() == 0) { propertyGrid1.SelectedObject = null; } while (modelObjectEnum.MoveNext()) { string objectType = modelObjectEnum.Current.GetType().ToString(); if (!arraySelectedObjects.Contains(objectType)) { arraySelectedObjects.Add(objectType); } } comboBox1.Text = ""; comboBox1.Items.Clear(); arraySelectedObjects.Sort(); foreach (string objectName in arraySelectedObjects) { comboBox1.Items.Add(objectName); } if (arraySelectedObjects.Count == 0) { Tekla.Structures.Model.UI.ModelViewEnumerator modelViewEnum = Tekla.Structures.Model.UI.ViewHandler.GetSelectedViews(); if (modelViewEnum.Count == 1) { modelView.GetProperties(); propertyGrid1.SelectedObject = modelView; comboBox1.SelectedText = "Tekla.Structures.Model.UI.View"; propertyGrid1.Focus(); } } if (arraySelectedObjects.Count == 1) { if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Model.Beam") { beam.GetProperties(); propertyGrid1.SelectedObject = beam; } else if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Model.ContourPlate") { contourPlate.GetProperties(); propertyGrid1.SelectedObject = contourPlate; } else if (arraySelectedObjects[0].ToString().Contains("Tekla.Structures.Model.Weld")) { modelWeld.GetProperties(); propertyGrid1.SelectedObject = modelWeld; } else if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Model.PolygonWeld") { modelWeld.GetProperties(); propertyGrid1.SelectedObject = modelWeld; } else if (arraySelectedObjects[0].ToString().Contains("Tekla.Structures.Model.Bolt")) { modelBolt.GetProperties(); propertyGrid1.SelectedObject = modelBolt; } else if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Model.Grid") { modelGrid.GetProperties(); propertyGrid1.SelectedObject = modelGrid; } else if (arraySelectedObjects[0].ToString() == "Tekla.Structures.Model.Connection") { modelConnection.GetProperties(); propertyGrid1.SelectedObject = modelConnection; } comboBox1.SelectedText = arraySelectedObjects[0].ToString(); propertyGrid1.Focus(); } if (arraySelectedObjects.Count > 1) { propertyGrid1.SelectedObject = null; } } } }
public void GetProperties() { DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected(); if (drawingObjectEnum.GetSize() == 1) { while (drawingObjectEnum.MoveNext()) { if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Text) { Tekla.Structures.Drawing.Text text = (Tekla.Structures.Drawing.Text)drawingObjectEnum.Current; Text.TextAttributes textAttributes = text.Attributes; if (textAttributes.PreferredPlacing.ToString() == "Tekla.Structures.Drawing.PointPlacingType") { preferredPlacingType = PreferredPlacingEnum.PointPlacingType; } else if (textAttributes.PreferredPlacing.ToString() == "Tekla.Structures.Drawing.LeaderLinePlacingType") { preferredPlacingType = PreferredPlacingEnum.LeaderLinePlacingType; } textString = text.TextString.Replace("\n", "¬"); fontColour = text.Attributes.Font.Color; fontHeight = text.Attributes.Font.Height.ToString(); fontName = text.Attributes.Font.Name; if (text.Attributes.Font.Bold) { fontBold = Bool.True; } else { fontBold = Bool.False; } if (text.Attributes.Font.Italic) { fontItalic = Bool.True; } else { fontItalic = Bool.False; } textAngle = text.Attributes.Angle.ToString(); if (text.Attributes.Alignment == Tekla.Structures.Drawing.TextAlignment.Center) { textAlignment = TextAlignmentEnum.Center; } else if (text.Attributes.Alignment == Tekla.Structures.Drawing.TextAlignment.Left) { textAlignment = TextAlignmentEnum.Left; } else if (text.Attributes.Alignment == Tekla.Structures.Drawing.TextAlignment.Right) { textAlignment = TextAlignmentEnum.Right; } if (text.Attributes.Frame.Type == FrameTypes.Circle) { frameType = FrameTypeEnum.Circle; } else if (text.Attributes.Frame.Type == FrameTypes.Diamond) { frameType = FrameTypeEnum.Diamond; } else if (text.Attributes.Frame.Type == FrameTypes.Hexagon) { frameType = FrameTypeEnum.Hexagon; } else if (text.Attributes.Frame.Type == FrameTypes.Line) { frameType = FrameTypeEnum.Line; } else if (text.Attributes.Frame.Type == FrameTypes.None) { frameType = FrameTypeEnum.None; } else if (text.Attributes.Frame.Type == FrameTypes.Rectangular) { frameType = FrameTypeEnum.Rectangular; } else if (text.Attributes.Frame.Type == FrameTypes.Round) { frameType = FrameTypeEnum.Round; } else if (text.Attributes.Frame.Type == FrameTypes.Sharpened) { frameType = FrameTypeEnum.Sharpened; } else if (text.Attributes.Frame.Type == FrameTypes.Triangle) { frameType = FrameTypeEnum.Triangle; } frameColour = text.Attributes.Frame.Color; if (text.Attributes.ArrowHead.Head == ArrowheadTypes.CircleArrow) { arrowheadType = ArrowheadTypeEnum.CircleArrow; } else if (text.Attributes.ArrowHead.Head == ArrowheadTypes.FilledArrow) { arrowheadType = ArrowheadTypeEnum.FilledArrow; } else if (text.Attributes.ArrowHead.Head == ArrowheadTypes.FilledCircleArrow) { arrowheadType = ArrowheadTypeEnum.FilledCircleArrow; } else if (text.Attributes.ArrowHead.Head == ArrowheadTypes.LineArrow) { arrowheadType = ArrowheadTypeEnum.LineArrow; } if (text.Attributes.ArrowHead.ArrowPosition == ArrowheadPositions.Both) { arrowheadPosition = ArrowheadPositionEnum.Both; } else if (text.Attributes.ArrowHead.ArrowPosition == ArrowheadPositions.End) { arrowheadPosition = ArrowheadPositionEnum.End; } else if (text.Attributes.ArrowHead.ArrowPosition == ArrowheadPositions.None) { arrowheadPosition = ArrowheadPositionEnum.None; } else if (text.Attributes.ArrowHead.ArrowPosition == ArrowheadPositions.Start) { arrowheadPosition = ArrowheadPositionEnum.Start; } arrowheadWidth = text.Attributes.ArrowHead.Width.ToString(); arrowheadHeight = text.Attributes.ArrowHead.Height.ToString(); } } } else if (drawingObjectEnum.GetSize() > 1) { preferredPlacingType = new PreferredPlacingEnum(); textString = ""; FontColour = new DrawingColors(); fontHeight = ""; fontName = ""; fontBold = new Bool(); fontItalic = new Bool(); textAngle = ""; textAlignment = new TextAlignmentEnum(); frameType = new FrameTypeEnum(); FrameColour = new DrawingColors(); arrowheadType = new ArrowheadTypeEnum(); arrowheadPosition = new ArrowheadPositionEnum(); arrowheadWidth = ""; arrowheadHeight = ""; } }
public void GetProperties() { DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected(); if (drawingObjectEnum.GetSize() == 1) { while (drawingObjectEnum.MoveNext()) { if (drawingObjectEnum.Current is Tekla.Structures.Drawing.GridLine) { Tekla.Structures.Drawing.GridLine grid = (Tekla.Structures.Drawing.GridLine)drawingObjectEnum.Current; if (grid.Attributes.DrawOnlyTextLabelsNotGridLines) { drawOnlyTextLabelsNotGridLines = Bool.True; } else { drawOnlyTextLabelsNotGridLines = Bool.False; } if (grid.Attributes.DrawTextAtEndOfGridLine) { drawTextAtEndOfGridLine = Bool.True; } else { drawTextAtEndOfGridLine = Bool.False; } if (grid.Attributes.DrawTextAtStartOfGridLine) { drawTextAtStartOfGridLine = Bool.True; } else { drawTextAtStartOfGridLine = Bool.False; } if (grid.Attributes.Font.Bold) { fontBold = Bool.True; } else { fontBold = Bool.False; } fontColour = grid.Attributes.Font.Color; fontHeight = grid.Attributes.Font.Height.ToString(); if (grid.Attributes.Font.Italic) { fontItalic = Bool.True; } else { fontItalic = Bool.False; } fontName = grid.Attributes.Font.Name; frameColour = grid.Attributes.Frame.Color; if (grid.Attributes.Frame.Type == FrameTypes.Circle) { frameType = FrameTypeEnum.Circle; } else if (grid.Attributes.Frame.Type == FrameTypes.Diamond) { frameType = FrameTypeEnum.Diamond; } else if (grid.Attributes.Frame.Type == FrameTypes.Hexagon) { frameType = FrameTypeEnum.Hexagon; } else if (grid.Attributes.Frame.Type == FrameTypes.Line) { frameType = FrameTypeEnum.Line; } else if (grid.Attributes.Frame.Type == FrameTypes.None) { frameType = FrameTypeEnum.None; } else if (grid.Attributes.Frame.Type == FrameTypes.Rectangular) { frameType = FrameTypeEnum.Rectangular; } else if (grid.Attributes.Frame.Type == FrameTypes.Round) { frameType = FrameTypeEnum.Round; } else if (grid.Attributes.Frame.Type == FrameTypes.Sharpened) { frameType = FrameTypeEnum.Sharpened; } else if (grid.Attributes.Frame.Type == FrameTypes.Triangle) { frameType = FrameTypeEnum.Triangle; } lineColour = grid.Attributes.Line.Color; if (grid.Attributes.Line.Type == LineTypes.DashDot) { lineType = LineTypeEnum.DashDot; } else if (grid.Attributes.Line.Type == LineTypes.DashDoubleDot) { lineType = LineTypeEnum.DashDoubleDot; } else if (grid.Attributes.Line.Type == LineTypes.DashedLine) { lineType = LineTypeEnum.DashedLine; } else if (grid.Attributes.Line.Type == LineTypes.DottedLine) { lineType = LineTypeEnum.DottedLine; } else if (grid.Attributes.Line.Type == LineTypes.SlashDash) { lineType = LineTypeEnum.SlashDash; } else if (grid.Attributes.Line.Type == LineTypes.SlashedLine) { lineType = LineTypeEnum.SlashedLine; } else if (grid.Attributes.Line.Type == LineTypes.SolidLine) { lineType = LineTypeEnum.SolidLine; } else if (grid.Attributes.Line.Type == LineTypes.UndefinedLine) { lineType = LineTypeEnum.UndefinedLine; } offsetAtEndOfLine = grid.Attributes.OffsetAtEndOfLine.ToString(); offsetAtStartOfLine = grid.Attributes.OffsetAtStartOfLine.ToString(); gridLabelText = grid.EndLabel.GridLabelText; } } } if (drawingObjectEnum.GetSize() > 1) { drawOnlyTextLabelsNotGridLines = new Bool(); drawTextAtEndOfGridLine = new Bool(); drawTextAtStartOfGridLine = new Bool(); fontColour = new DrawingColors(); fontHeight = ""; fontBold = new Bool(); fontItalic = new Bool(); fontName = ""; frameColour = new DrawingColors(); frameType = new FrameTypeEnum(); lineColour = new DrawingColors(); lineType = new LineTypeEnum(); offsetAtEndOfLine = ""; offsetAtStartOfLine = ""; gridLabelText = ""; } }
public void GetProperties() { DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected(); if (drawingObjectEnum.GetSize() == 1) { while (drawingObjectEnum.MoveNext()) { if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Part) { Tekla.Structures.Drawing.Part drawingPart = (Tekla.Structures.Drawing.Part)drawingObjectEnum.Current; if (drawingPart.Attributes.DrawCenterLine) { drawCenterLine = Bool.True; } else { drawCenterLine = Bool.False; } if (drawingPart.Attributes.DrawChamfers) { drawChamfers = Bool.True; } else { drawChamfers = Bool.False; } //drawConnectingSideMarks = drawingPart.Attributes.DrawConnectingSideMarks; if (drawingPart.Attributes.DrawHiddenLines) { drawHiddenLines = Bool.True; } else { drawHiddenLines = Bool.False; } if (drawingPart.Attributes.DrawOrientationMark) { drawOrientationMark = Bool.True; } else { drawOrientationMark = Bool.False; } if (drawingPart.Attributes.DrawOwnHiddenLines) { drawOwnHiddenLines = Bool.True; } else { drawOwnHiddenLines = Bool.False; } if (drawingPart.Attributes.DrawPopMarks) { drawPopMarks = Bool.True; } else { drawPopMarks = Bool.False; } if (drawingPart.Attributes.DrawReferenceLine) { drawReferenceLine = Bool.True; } else { drawReferenceLine = Bool.False; } visibleLinesColour = drawingPart.Attributes.VisibleLines.Color; if (drawingPart.Attributes.VisibleLines.Type == LineTypes.DashDot) { visibleLinesType = LineTypeEnum.DashDot; } else if (drawingPart.Attributes.VisibleLines.Type == LineTypes.DashDoubleDot) { visibleLinesType = LineTypeEnum.DashDoubleDot; } else if (drawingPart.Attributes.VisibleLines.Type == LineTypes.DashedLine) { visibleLinesType = LineTypeEnum.DashedLine; } else if (drawingPart.Attributes.VisibleLines.Type == LineTypes.DottedLine) { visibleLinesType = LineTypeEnum.DottedLine; } else if (drawingPart.Attributes.VisibleLines.Type == LineTypes.SlashDash) { visibleLinesType = LineTypeEnum.SlashDash; } else if (drawingPart.Attributes.VisibleLines.Type == LineTypes.SlashedLine) { visibleLinesType = LineTypeEnum.SlashedLine; } else if (drawingPart.Attributes.VisibleLines.Type == LineTypes.SolidLine) { visibleLinesType = LineTypeEnum.SolidLine; } else if (drawingPart.Attributes.VisibleLines.Type == LineTypes.UndefinedLine) { visibleLinesType = LineTypeEnum.UndefinedLine; } hiddenLinesColour = drawingPart.Attributes.HiddenLines.Color; if (drawingPart.Attributes.HiddenLines.Type == LineTypes.DashDot) { hiddenLinesType = LineTypeEnum.DashDot; } else if (drawingPart.Attributes.HiddenLines.Type == LineTypes.DashDoubleDot) { hiddenLinesType = LineTypeEnum.DashDoubleDot; } else if (drawingPart.Attributes.HiddenLines.Type == LineTypes.DashedLine) { hiddenLinesType = LineTypeEnum.DashedLine; } else if (drawingPart.Attributes.HiddenLines.Type == LineTypes.DottedLine) { hiddenLinesType = LineTypeEnum.DottedLine; } else if (drawingPart.Attributes.HiddenLines.Type == LineTypes.SlashDash) { hiddenLinesType = LineTypeEnum.SlashDash; } else if (drawingPart.Attributes.HiddenLines.Type == LineTypes.SlashedLine) { hiddenLinesType = LineTypeEnum.SlashedLine; } else if (drawingPart.Attributes.HiddenLines.Type == LineTypes.SolidLine) { hiddenLinesType = LineTypeEnum.SolidLine; } else if (drawingPart.Attributes.HiddenLines.Type == LineTypes.UndefinedLine) { hiddenLinesType = LineTypeEnum.UndefinedLine; } referenceLinesColour = drawingPart.Attributes.ReferenceLine.Color; if (drawingPart.Attributes.VisibleLines.Type == LineTypes.DashDot) { visibleLinesType = LineTypeEnum.DashDot; } else if (drawingPart.Attributes.ReferenceLine.Type == LineTypes.DashDoubleDot) { referenceLinesType = LineTypeEnum.DashDoubleDot; } else if (drawingPart.Attributes.ReferenceLine.Type == LineTypes.DashedLine) { referenceLinesType = LineTypeEnum.DashedLine; } else if (drawingPart.Attributes.ReferenceLine.Type == LineTypes.DottedLine) { referenceLinesType = LineTypeEnum.DottedLine; } else if (drawingPart.Attributes.ReferenceLine.Type == LineTypes.SlashDash) { referenceLinesType = LineTypeEnum.SlashDash; } else if (drawingPart.Attributes.ReferenceLine.Type == LineTypes.SlashedLine) { referenceLinesType = LineTypeEnum.SlashedLine; } else if (drawingPart.Attributes.ReferenceLine.Type == LineTypes.SolidLine) { referenceLinesType = LineTypeEnum.SolidLine; } else if (drawingPart.Attributes.ReferenceLine.Type == LineTypes.UndefinedLine) { referenceLinesType = LineTypeEnum.UndefinedLine; } } } } else if (drawingObjectEnum.GetSize() > 1) { drawCenterLine = new Bool(); drawChamfers = new Bool(); drawHiddenLines = new Bool(); drawOrientationMark = new Bool(); drawOwnHiddenLines = new Bool(); DrawPopMarks = new Bool(); drawReferenceLine = new Bool(); visibleLinesColour = new DrawingColors(); visibleLinesType = new LineTypeEnum(); hiddenLinesColour = new DrawingColors(); hiddenLinesType = new LineTypeEnum(); referenceLinesColour = new DrawingColors(); referenceLinesType = new LineTypeEnum(); } }
public void GetProperties() { DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected(); if (drawingObjectEnum.GetSize() == 1) { while (drawingObjectEnum.MoveNext()) { if (drawingObjectEnum.Current is Tekla.Structures.Drawing.StraightDimensionSet) { Tekla.Structures.Drawing.StraightDimensionSet straightDim = (Tekla.Structures.Drawing.StraightDimensionSet)drawingObjectEnum.Current; dimensionType = straightDim.Attributes.DimensionType; if (straightDim.Attributes.ShortDimension == DimensionSetBaseAttributes.ShortDimensionTypes.Inside) { shortDimensionType = ShortDimensionEnum.Inside; } else { shortDimensionType = ShortDimensionEnum.Outside; } if (straightDim.Attributes.Format.Unit == DimensionSetBaseAttributes.DimensionValueUnits.Automatic) { dimensionUnits = DimensionUnitsEnum.Automatic; } else if (straightDim.Attributes.Format.Unit == DimensionSetBaseAttributes.DimensionValueUnits.Centimeter) { dimensionUnits = DimensionUnitsEnum.Centimeter; } else if (straightDim.Attributes.Format.Unit == DimensionSetBaseAttributes.DimensionValueUnits.Inch) { dimensionUnits = DimensionUnitsEnum.Inch; } else if (straightDim.Attributes.Format.Unit == DimensionSetBaseAttributes.DimensionValueUnits.Meter) { dimensionUnits = DimensionUnitsEnum.Meter; } else if (straightDim.Attributes.Format.Unit == DimensionSetBaseAttributes.DimensionValueUnits.Millimeter) { dimensionUnits = DimensionUnitsEnum.Millimeter; } colour = straightDim.Attributes.Color; fontName = straightDim.Attributes.Text.Font.Name; fontHeight = straightDim.Attributes.Text.Font.Height.ToString(); fontColour = straightDim.Attributes.Text.Font.Color; if (straightDim.Attributes.Text.Font.Italic) { fontItalic = Bool.True; } else { fontItalic = Bool.False; } if (straightDim.Attributes.Text.Font.Bold) { fontBold = Bool.True; } else { fontBold = Bool.False; } if (straightDim.Attributes.Placing.Placing == DimensionSetBaseAttributes.Placings.Free) { placing = PlacingEnum.Free; } else { placing = PlacingEnum.Fixed; } if (straightDim.Attributes.Placing.Direction.Negative) { placingDirectionNegative = Bool.True; } else { placingDirectionNegative = Bool.False; } if (straightDim.Attributes.Placing.Direction.Positive) { placingDirectionPositive = Bool.True; } else { placingDirectionPositive = Bool.False; } minimalDistance = straightDim.Attributes.Placing.Distance.MinimalDistance.ToString(); searchMargin = straightDim.Attributes.Placing.Distance.SearchMargin.ToString(); } } } else if (drawingObjectEnum.GetSize() > 1) { dimensionType = new DimensionSetBaseAttributes.DimensionTypes(); shortDimensionType = new ShortDimensionEnum(); dimensionUnits = new DimensionUnitsEnum(); colour = new DrawingColors(); fontName = ""; fontHeight = ""; fontColour = new DrawingColors(); fontItalic = new Bool(); fontBold = new Bool(); placing = new PlacingEnum(); placingDirectionNegative = new Bool(); placingDirectionPositive = new Bool(); minimalDistance = ""; searchMargin = ""; } }
/// <summary> /// 线程图纸标注函数; /// </summary> /// <param name="message"></param> private void DimDrawingThreadFunc(object message) { DrawingHandler drawingHandler = new DrawingHandler(); int nIndex = 0; int nCount = mrAssemblyDrawingList.Count; mMainForm.SetWholeProgressMax(nCount); string strCurrentTips = ""; string strWholeTips = ""; foreach (CMrAssemblyDrawing mrDrawing in mrAssemblyDrawingList) { nIndex++; mMainForm.SetWholeProgressPos(nIndex); strWholeTips = "总进度:" + nIndex + "/" + nCount.ToString(); mMainForm.SetWholeLabelText(strWholeTips); int nViewIndex = 0; AssemblyDrawing assemblyDrawing = mrDrawing.mAssemblyDring; Identifier assemblyDrawingIdentifier = assemblyDrawing.AssemblyIdentifier; if (assemblyDrawing == null) { continue; } try { Assembly assembly = new Assembly { Identifier = assemblyDrawing.AssemblyIdentifier }; assembly.Select(); Identifier identifier = assembly.GetMainPart().Identifier; Beam modelObject = mModel.SelectModelObject(identifier) as Beam; drawingHandler.SetActiveDrawing(assemblyDrawing, true); DrawingObjectEnumerator allViews = assemblyDrawing.GetSheet().GetAllViews(); //1.判断是否需要创建自动剖面; if (CCommonPara.mAutoSectionType == MrAutoSectionType.MrListDim || CCommonPara.mAutoSectionType == MrAutoSectionType.MrTwoTypeDim) { CreateAutoSection(mrDrawing.mDimType, modelObject, assemblyDrawing); } int nViewCount = allViews.GetSize(); mMainForm.SetCurrentProgressMax(nViewCount); while (allViews.MoveNext()) { if (allViews.Current != null) { nViewIndex++; mMainForm.SetCurrentProgressPos(nViewIndex); strCurrentTips = "当前进度:" + nViewIndex + "/" + nViewCount.ToString(); mMainForm.SetCurrentLabelText(strCurrentTips); TSD.View view = allViews.Current as TSD.View; if (view != null) { DrawDrawingByView(view, modelObject, mrDrawing.mDimType); } } } assemblyDrawing.IsFrozen = true; assemblyDrawing.PlaceViews(); assemblyDrawing.Modify(); drawingHandler.SaveActiveDrawing(); drawingHandler.CloseActiveDrawing(); } catch (System.Exception ex) { string strName = assemblyDrawing.Name; MessageBox.Show("图纸" + strName + "标注失败,请确认模型或图纸内是否有问题。异常信息:" + ex.Message); drawingHandler.SaveActiveDrawing(); drawingHandler.CloseActiveDrawing(); nIndex++; mMainForm.SetWholeProgressPos(nIndex); strWholeTips = "总进度:" + nIndex + "/" + nCount.ToString(); mMainForm.SetWholeLabelText(strWholeTips); continue; } } MessageBox.Show("扬州Tekla培训石头哥提示您标注结束,感谢您对智能标注系统的支持。"); }
public static void Run(Tekla.Technology.Akit.IScript akit) { try { Model model = new Model(); DrawingHandler drawingHandler = new DrawingHandler(); DrawingObjectEnumerator MyDrawingObjEnum = drawingHandler.GetDrawingObjectSelector().GetSelected(); Tekla.Structures.Model.UI.ModelObjectSelector SelectObjects = new Tekla.Structures.Model.UI.ModelObjectSelector(); Tekla.Structures.Drawing.Weld SelectedWeld = null; if (MyDrawingObjEnum.GetSize() == 1) { while (MyDrawingObjEnum.MoveNext()) { if (MyDrawingObjEnum.Current is Tekla.Structures.Drawing.Weld) { SelectedWeld = MyDrawingObjEnum.Current as Tekla.Structures.Drawing.Weld; ArrayList temp = new ArrayList(); temp.Add(model.SelectModelObject(new Identifier(SelectedWeld.ModelIdentifier.ID))); SelectObjects.Select(temp); BaseWeld SelectedModelWeld = temp[0] as BaseWeld; string strSizeAbove = SelectedModelWeld.SizeAbove.ToString(); string strTypeAbove = SelectedModelWeld.TypeAbove.ToString(); if (strTypeAbove == "WELD_TYPE_FILLET") { strTypeAbove = "10"; // Fillet weld } if (strTypeAbove == "WELD_TYPE_SINGLE_BEVEL_BUTT_WITH_BROAD_ROOT_FACE") { strTypeAbove = "6"; // W1 weld } if (strTypeAbove == "WELD_TYPE_NONE") { strTypeAbove = "0"; // No weld } if (strTypeAbove == "WELD_TYPE_BEVEL_GROOVE_SINGLE_BEVEL_BUTT") { strTypeAbove = "4"; // W6 weld } if (strTypeAbove == "WELD_TYPE_SQUARE_GROOVE_SQUARE_BUTT") { strTypeAbove = "2"; // W3 weld } if (strTypeAbove == "WELD_TYPE_PLUG") { strTypeAbove = "11"; // Plug weld } if (strTypeAbove == "WELD_TYPE_BEVEL_BACKING") { strTypeAbove = "9"; // Seal weld } if (strTypeAbove == "WELD_TYPE_PARTIAL_PENETRATION_SINGLE_BEVEL_BUTT_PLUS_FILLET") { strTypeAbove = "18"; // W1 weld + reinforced } string strContourAbove = SelectedModelWeld.ContourAbove.ToString(); if (strContourAbove == "WELD_CONTOUR_NONE") { strContourAbove = "0"; } if (strContourAbove == "WELD_CONTOUR_FLUSH") { strContourAbove = "1"; } string strSizeBelow = SelectedModelWeld.SizeBelow.ToString(); string strTypeBelow = SelectedModelWeld.TypeBelow.ToString(); if (strTypeBelow == "WELD_TYPE_FILLET") { strTypeBelow = "10"; } if (strTypeBelow == "WELD_TYPE_SINGLE_BEVEL_BUTT_WITH_BROAD_ROOT_FACE") { strTypeBelow = "6"; } if (strTypeBelow == "WELD_TYPE_NONE") { strTypeBelow = "0"; // No weld } if (strTypeBelow == "WELD_TYPE_BEVEL_GROOVE_SINGLE_BEVEL_BUTT") { strTypeBelow = "4"; // W6 weld } if (strTypeBelow == "WELD_TYPE_SQUARE_GROOVE_SQUARE_BUTT") { strTypeBelow = "2"; // W3 weld } if (strTypeBelow == "WELD_TYPE_PLUG") { strTypeBelow = "11"; // Plug weld } if (strTypeBelow == "WELD_TYPE_BEVEL_BACKING") { strTypeBelow = "9"; // Seal weld } if (strTypeBelow == "WELD_TYPE_PARTIAL_PENETRATION_SINGLE_BEVEL_BUTT_PLUS_FILLET") { strTypeBelow = "18"; // W1 weld + reinforced } string strContourBelow = SelectedModelWeld.ContourBelow.ToString(); if (strContourBelow == "WELD_CONTOUR_NONE") { strContourBelow = "0"; } if (strContourBelow == "WELD_CONTOUR_FLUSH") { strContourBelow = "1"; } string strAroundWeld = SelectedModelWeld.AroundWeld.ToString(); if (strAroundWeld == "False") { strAroundWeld = "0"; } if (strAroundWeld == "True") { strAroundWeld = "1"; } string strRefText = SelectedModelWeld.ReferenceText; akit.PushButton("wld_cancel", "Weld Mark Properties"); akit.Callback("acmd_display_attr_dialog", "wld_dial", "main_frame"); akit.ValueChange("wld_dial", "gr_wld_get_menu", "standard"); akit.ValueChange("wld_dial", "w_size", strSizeAbove); akit.ValueChange("wld_dial", "w_size2", strSizeBelow); akit.ValueChange("wld_dial", "w_type", strTypeAbove); akit.ValueChange("wld_dial", "w_type2", strTypeBelow); akit.ValueChange("wld_dial", "w_ftype", strContourAbove); akit.ValueChange("wld_dial", "w_ftype2", strContourBelow); akit.ValueChange("wld_dial", "w_around", strAroundWeld); akit.ValueChange("wld_dial", "w_wld", strRefText); akit.PushButton("wld_apply", "wld_dial"); akit.CommandStart("ail_create_wld", "", "main_frame"); } } Tekla.Structures.Drawing.UI.DrawingObjectSelector drawingObjectSelector = drawingHandler.GetDrawingObjectSelector(); drawingObjectSelector.SelectObject(SelectedWeld); } } catch { } }
private void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { Drawing drawing = drawingHandler.GetActiveDrawing(); if (drawing == null) { if (comboBox1.Text == "Tekla.Structures.Model.Beam") { beam.Modify(e); } if (comboBox1.Text == "Tekla.Structures.Model.ContourPlate") { contourPlate.Modify(e); } if (comboBox1.Text.Contains("Tekla.Structures.Model.Bolt")) { modelBolt.Modify(e); } if (comboBox1.Text.Contains("Tekla.Structures.Model.Weld")) { modelWeld.Modify(e); } if (comboBox1.Text == "Tekla.Structures.Model.Grid") { modelGrid.Modify(e); } if (comboBox1.Text == "Tekla.Structures.Model.UI.View") { modelView.Modify(e); } model.CommitChanges(); } if (drawing != null) { DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected(); if (drawingObjectEnum.GetSize() == 0) { activeDrawing.Modify(e); } if (comboBox1.Text == "Tekla.Structures.Drawing.Line") { line.Modify(e); } if (comboBox1.Text == "Tekla.Structures.Drawing.Arc") { arc.Modify(e); } if (comboBox1.Text == "Tekla.Structures.Drawing.Polyline") { polyline.Modify(e); } if (comboBox1.Text == "Tekla.Structures.Drawing.Rectangle") { rectangle.Modify(e); } if (comboBox1.Text == "Tekla.Structures.Drawing.Circle") { circle.Modify(e); } if (comboBox1.Text == "Tekla.Structures.Drawing.Polygon") { polygon.Modify(e); } if (comboBox1.Text == "Tekla.Structures.Drawing.Text") { text.Modify(e); } if (comboBox1.Text == "Tekla.Structures.Drawing.View") { view.Modify(e); } if (comboBox1.Text == "Tekla.Structures.Drawing.GridLine") { drawingGrid.Modify(e); } if (comboBox1.Text == "Tekla.Structures.Drawing.Part") { drawingPart.Modify(e); } if (comboBox1.Text == "Tekla.Structures.Drawing.Bolt") { drawingBolt.Modify(e); } if (comboBox1.Text == "Tekla.Structures.Drawing.Symbol") { symbol.Modify(e); } if (comboBox1.Text == "Tekla.Structures.Drawing.Mark") { mark.Modify(e); } if (comboBox1.Text == "Tekla.Structures.Drawing.StraightDimensionSet") { straightDim.Modify(e); } if (comboBox1.Text == "Tekla.Structures.Drawing.RadiusDimension") { radiusDim.Modify(e); } if (comboBox1.Text == "Tekla.Structures.Drawing.CurvedDimensionSetRadial") { radialDim.Modify(e); } if (comboBox1.Text == "Tekla.Structures.Drawing.AngleDimension") { angleDim.Modify(e); } } }