Ejemplo n.º 1
0
            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.RadiusDimension)
                    {
                        Tekla.Structures.Drawing.RadiusDimension radiusDim = (Tekla.Structures.Drawing.RadiusDimension)drawingObjectEnum.Current;
                        if (label == "Distance")
                        {
                            radiusDim.Distance = double.Parse(distance);
                        }
                        if (label == "DimensionUnits")
                        {
                            if (dimensionUnits == DimensionUnitsEnum.Automatic)
                            {
                                radiusDim.Attributes.Format.Unit = DimensionSetBaseAttributes.DimensionValueUnits.Automatic;
                            }
                            else if (dimensionUnits == DimensionUnitsEnum.Centimeter)
                            {
                                radiusDim.Attributes.Format.Unit = DimensionSetBaseAttributes.DimensionValueUnits.Centimeter;
                            }
                            else if (dimensionUnits == DimensionUnitsEnum.Inch)
                            {
                                radiusDim.Attributes.Format.Unit = DimensionSetBaseAttributes.DimensionValueUnits.Inch;
                            }
                            else if (dimensionUnits == DimensionUnitsEnum.Meter)
                            {
                                radiusDim.Attributes.Format.Unit = DimensionSetBaseAttributes.DimensionValueUnits.Meter;
                            }
                            else if (dimensionUnits == DimensionUnitsEnum.Millimeter)
                            {
                                radiusDim.Attributes.Format.Unit = DimensionSetBaseAttributes.DimensionValueUnits.Millimeter;
                            }
                        }
                        if (label == "Colour")
                        {
                            radiusDim.Attributes.Color = colour;
                        }
                        if (label == "FontName")
                        {
                            radiusDim.Attributes.Text.Font.Name = fontName;
                        }
                        if (label == "FontHeight")
                        {
                            radiusDim.Attributes.Text.Font.Height = double.Parse(fontHeight);
                        }
                        if (label == "FontColour")
                        {
                            radiusDim.Attributes.Text.Font.Color = fontColour;
                        }
                        if (label == "FontItalic")
                        {
                            radiusDim.Attributes.Text.Font.Italic = bool.Parse(fontItalic.ToString());
                        }
                        if (label == "FontBold")
                        {
                            radiusDim.Attributes.Text.Font.Bold = bool.Parse(fontBold.ToString());
                        }
                        if (label == "Placing")
                        {
                            if (placing == PlacingEnum.Fixed)
                            {
                                radiusDim.Attributes.Placing.Placing = DimensionSetBaseAttributes.Placings.Fixed;
                            }
                            else if (placing == PlacingEnum.Free)
                            {
                                radiusDim.Attributes.Placing.Placing = DimensionSetBaseAttributes.Placings.Free;
                            }
                        }

                        if (label == "PlacingDirectionNegative")
                        {
                            radiusDim.Attributes.Placing.Direction.Negative = bool.Parse(placingDirectionNegative.ToString());
                        }
                        if (label == "PlacingDirectionPositive")
                        {
                            radiusDim.Attributes.Placing.Direction.Positive = bool.Parse(placingDirectionPositive.ToString());
                        }
                        if (label == "MinimalDistance")
                        {
                            radiusDim.Attributes.Placing.Distance.MinimalDistance = double.Parse(minimalDistance);
                        }
                        if (label == "SearchMargin")
                        {
                            radiusDim.Attributes.Placing.Distance.SearchMargin = double.Parse(searchMargin);
                        }
                        radiusDim.Modify();
                        drawing.CommitChanges();
                    }
                }
            }
Ejemplo n.º 2
0
            public void GetProperties()
            {
                DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected();

                if (drawingObjectEnum.GetSize() == 1)
                {
                    while (drawingObjectEnum.MoveNext())
                    {
                        if (drawingObjectEnum.Current is Tekla.Structures.Drawing.RadiusDimension)
                        {
                            Tekla.Structures.Drawing.RadiusDimension radiusDim = (Tekla.Structures.Drawing.RadiusDimension)drawingObjectEnum.Current;

                            if (radiusDim.Attributes.Format.Unit == DimensionSetBaseAttributes.DimensionValueUnits.Automatic)
                            {
                                dimensionUnits = DimensionUnitsEnum.Automatic;
                            }
                            else if (radiusDim.Attributes.Format.Unit == DimensionSetBaseAttributes.DimensionValueUnits.Centimeter)
                            {
                                dimensionUnits = DimensionUnitsEnum.Centimeter;
                            }
                            else if (radiusDim.Attributes.Format.Unit == DimensionSetBaseAttributes.DimensionValueUnits.Inch)
                            {
                                dimensionUnits = DimensionUnitsEnum.Inch;
                            }
                            else if (radiusDim.Attributes.Format.Unit == DimensionSetBaseAttributes.DimensionValueUnits.Meter)
                            {
                                dimensionUnits = DimensionUnitsEnum.Meter;
                            }
                            else if (radiusDim.Attributes.Format.Unit == DimensionSetBaseAttributes.DimensionValueUnits.Millimeter)
                            {
                                dimensionUnits = DimensionUnitsEnum.Millimeter;
                            }

                            if (radiusDim.Attributes.Placing.Direction.Negative)
                            {
                                placingDirectionNegative = Bool.True;
                            }
                            else
                            {
                                placingDirectionNegative = Bool.False;
                            }
                            if (radiusDim.Attributes.Placing.Direction.Positive)
                            {
                                placingDirectionPositive = Bool.True;
                            }
                            else
                            {
                                placingDirectionPositive = Bool.False;
                            }
                            minimalDistance = radiusDim.Attributes.Placing.Distance.MinimalDistance.ToString();
                            searchMargin    = radiusDim.Attributes.Placing.Distance.SearchMargin.ToString();
                            if (radiusDim.Attributes.Placing.Placing == DimensionSetBaseAttributes.Placings.Free)
                            {
                                placing = PlacingEnum.Free;
                            }
                            else
                            {
                                placing = PlacingEnum.Fixed;
                            }

                            colour     = radiusDim.Attributes.Color;
                            fontName   = radiusDim.Attributes.Text.Font.Name;
                            fontHeight = radiusDim.Attributes.Text.Font.Height.ToString();
                            fontColour = radiusDim.Attributes.Text.Font.Color;
                            if (radiusDim.Attributes.Text.Font.Italic)
                            {
                                fontItalic = Bool.True;
                            }
                            else
                            {
                                fontItalic = Bool.False;
                            }
                            if (radiusDim.Attributes.Text.Font.Bold)
                            {
                                fontBold = Bool.True;
                            }
                            else
                            {
                                fontBold = Bool.False;
                            }

                            distance = radiusDim.Distance.ToString("F02");
                        }
                    }
                }
                if (drawingObjectEnum.GetSize() > 1)
                {
                    distance                 = "";
                    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             = "";
                }
            }