示例#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.View)
                {
                    Tekla.Structures.Drawing.View drawingView = (Tekla.Structures.Drawing.View)drawingObjectEnum.Current;
                    if (label == "Scale")
                    {
                        drawingView.Attributes.Scale = double.Parse(scale);
                    }
                    if (label == "SizeXMin")
                    {
                        drawingView.RestrictionBox.MinPoint.X = double.Parse(sizeXMin);
                    }
                    if (label == "SizeXMax")
                    {
                        drawingView.RestrictionBox.MaxPoint.X = double.Parse(sizeXMax);
                    }
                    if (label == "SizeYMin")
                    {
                        drawingView.RestrictionBox.MinPoint.Y = double.Parse(sizeYMin);
                    }
                    if (label == "SizeYMax")
                    {
                        drawingView.RestrictionBox.MaxPoint.Y = double.Parse(sizeYMax);
                    }
                    if (label == "SizeDepthDown")
                    {
                        drawingView.RestrictionBox.MinPoint.Z = double.Parse(sizeDepthDown) * -1;
                    }
                    if (label == "SizeDepthUp")
                    {
                        drawingView.RestrictionBox.MaxPoint.Z = double.Parse(sizeDepthUp);
                    }
                    if (label == "ViewExtension")
                    {
                        drawingView.Attributes.ViewExtensionForNeighbourParts = double.Parse(viewExtension);
                    }
                    if (label == "FixedViewPlacing")
                    {
                        drawingView.Attributes.FixedViewPlacing = bool.Parse(fixedViewPlacing.ToString());
                    }
                    if (label == "CutParts")
                    {
                        drawingView.Attributes.Shortening.CutParts = bool.Parse(cutParts.ToString());
                    }
                    if (label == "MinimumLength")
                    {
                        drawingView.Attributes.Shortening.MinimumLength = double.Parse(minimumLength);
                    }
                    drawingView.Modify();
                    drawing.CommitChanges();
                }
            }
        }
示例#2
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.Bolt)
                {
                    Tekla.Structures.Drawing.Bolt drawingBolt = (Tekla.Structures.Drawing.Bolt)drawingObjectEnum.Current;
                    if (label == "BoltRepresentation")
                    {
                        drawingBolt.Attributes.Representation = boltRepresentation;
                    }
                    if (label == "SymbolContainsAxis")
                    {
                        drawingBolt.Attributes.SymbolContainsAxis = bool.Parse(symbolContainsAxis.ToString());
                    }
                    if (label == "SymbolContainsHole")
                    {
                        drawingBolt.Attributes.SymbolContainsHole = bool.Parse(symbolContainsHole.ToString());
                    }
                    if (label == "Colour")
                    {
                        drawingBolt.Attributes.Color = colour;
                    }
                    drawingBolt.Modify();
                    drawing.CommitChanges();
                }
            }
        }
示例#3
0
        public void ToStringTest()
        {
            var trueExp  = new Bool(true);
            var falseExp = new Bool(false);

            Assert.Equal("True", trueExp.ToString());
            Assert.Equal("False", falseExp.ToString());
        }
示例#4
0
        public void ConvertToString()
        {
            Bool boolTrue  = true;
            Bool boolFalse = false;

            Assert.Equal(true.ToString(), boolTrue.ToString());
            Assert.Equal(false.ToString(), boolFalse.ToString());
        }
示例#5
0
        public override string ToString()
        {
            switch (Type)
            {
            case PropertyType.Null:                 return("null");

            case PropertyType.Calculated:           return("calculated");

            case PropertyType.Bool:                 return(Bool.ToString());

            case PropertyType.String:               return("string: " + StringHandle.ToString());

            case PropertyType.MultiValue:           return("multi: " + MultiValueHandle.ToString());

            case PropertyType.Enum:                 return("enum: " + Enum.ToString());

            case PropertyType.Color:                return("color: " + Color.ToString());

            case PropertyType.Integer:              return(Integer.ToString() + " (integer)");

            case PropertyType.Fractional:           return(Fractional.ToString() + " (fractional)");

            case PropertyType.Percentage:           return(Percentage.ToString() + "%");

            case PropertyType.AbsLength:            return(Points.ToString() + "pt (" + Inches.ToString() + "in, " + Millimeters.ToString() + "mm) (abs)");

            case PropertyType.RelLength:            return(Points.ToString() + "pt (" + Inches.ToString() + "in, " + Millimeters.ToString() + "mm) (rel)");

            case PropertyType.HtmlFontUnits:        return(HtmlFontUnits.ToString() + " (html font units)");

            case PropertyType.RelHtmlFontUnits:     return(RelativeHtmlFontUnits.ToString() + " (relative html font units)");

            case PropertyType.Multiple:             return(Integer.ToString() + "*");

            case PropertyType.Pixels:               return(Pixels.ToString() + "px");

            case PropertyType.Ems:                  return(Ems.ToString() + "em");

            case PropertyType.Exs:                  return(Exs.ToString() + "ex");

            case PropertyType.Milliseconds:         return(Milliseconds.ToString() + "ms");

            case PropertyType.kHz:                  return(kHz.ToString() + "kHz");

            case PropertyType.Degrees:              return(Degrees.ToString() + "deg");
            }

            return("unknown value type");
        }
示例#6
0
        public override string ToString()
        {
            if (_type == typeof(bool))
            {
                return(Bool.ToString());
            }
            if (_type == typeof(long))
            {
                return(Long.ToString());
            }
            if (_type == typeof(double))
            {
                return(Double.ToString(CultureInfo.InvariantCulture));
            }
            if (_type == typeof(string))
            {
                return(String);
            }

            throw new NotImplementedException(_type.ToString());
        }
        public override string ToString()
        {
            switch (Type)
            {
            case ValueType.Unknown:
                return(ValueType.Unknown.ToString());

            case ValueType.Bool:
                return(Bool.ToString());

            case ValueType.Int:
                return(Int.ToString());

            case ValueType.Float:
                return(Float.ToString());

            case ValueType.Float2:
                return(Float2.ToString());

            case ValueType.Float3:
                return(Float3.ToString());

            case ValueType.Float4:
                return(Float4.ToString());

            case ValueType.Quaternion:
                return(Quaternion.ToString());

            case ValueType.Entity:
                return(Entity.ToString());

            case ValueType.StringReference:
                return(_string.ToString());

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        public string ToPrettyString()
        {
            switch (Type)
            {
            case ValueType.Unknown:
                return(ValueType.Unknown.ToString());

            case ValueType.Bool:
                return(Bool.ToString(CultureInfo.InvariantCulture));

            case ValueType.Int:
                return(Int.ToString(CultureInfo.InvariantCulture));

            case ValueType.Float:
                return(Float.ToString("F2"));

            case ValueType.Float2:
                return(Float2.ToString("F2", CultureInfo.InvariantCulture));

            case ValueType.Float3:
                return(Float3.ToString("F2", CultureInfo.InvariantCulture));

            case ValueType.Float4:
                return(Float4.ToString("F2", CultureInfo.InvariantCulture));

            case ValueType.Quaternion:
                return(Quaternion.ToString("F2", CultureInfo.InvariantCulture));

            case ValueType.Entity:
                return(Entity.ToString());

            case ValueType.StringReference:
                return(_string.ToString());

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
示例#9
0
        public void BoolToStringTest()
        {
            var exp = new Bool(false);

            Assert.Equal("False", exp.ToString(commoonFormatter));
        }
示例#10
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.GridLine)
                {
                    Tekla.Structures.Drawing.GridLine grid = (Tekla.Structures.Drawing.GridLine)drawingObjectEnum.Current;
                    if (label == "DrawOnlyTextLabelsNotGridLines")
                    {
                        grid.Attributes.DrawOnlyTextLabelsNotGridLines = bool.Parse(DrawOnlyTextLabelsNotGridLines.ToString());
                    }
                    if (label == "DrawTextAtEndOfGridLine")
                    {
                        grid.Attributes.DrawTextAtEndOfGridLine = bool.Parse(drawTextAtEndOfGridLine.ToString());
                    }
                    if (label == "DrawTextAtStartOfGridLine")
                    {
                        grid.Attributes.DrawTextAtStartOfGridLine = bool.Parse(drawTextAtStartOfGridLine.ToString());
                    }
                    if (label == "FontBold")
                    {
                        grid.Attributes.Font.Bold = bool.Parse(fontBold.ToString());
                    }
                    if (label == "FontColour")
                    {
                        grid.Attributes.Font.Color = fontColour;
                    }
                    if (label == "FontHeight")
                    {
                        grid.Attributes.Font.Height = double.Parse(fontHeight);
                    }
                    if (label == "FontItalic")
                    {
                        grid.Attributes.Font.Italic = bool.Parse(fontItalic.ToString());
                    }
                    if (label == "FontName")
                    {
                        grid.Attributes.Font.Name = fontName;
                    }
                    if (label == "FrameColour")
                    {
                        grid.Attributes.Frame.Color = frameColour;
                    }
                    if (label == "FrameType")
                    {
                        if (frameType == FrameTypeEnum.Circle)
                        {
                            grid.Attributes.Frame.Type = FrameTypes.Circle;
                        }
                        else if (frameType == FrameTypeEnum.Diamond)
                        {
                            grid.Attributes.Frame.Type = FrameTypes.Diamond;
                        }
                        else if (frameType == FrameTypeEnum.Hexagon)
                        {
                            grid.Attributes.Frame.Type = FrameTypes.Hexagon;
                        }
                        else if (frameType == FrameTypeEnum.Line)
                        {
                            grid.Attributes.Frame.Type = FrameTypes.Line;
                        }
                        else if (frameType == FrameTypeEnum.None)
                        {
                            grid.Attributes.Frame.Type = FrameTypes.None;
                        }
                        else if (frameType == FrameTypeEnum.Rectangular)
                        {
                            grid.Attributes.Frame.Type = FrameTypes.Rectangular;
                        }
                        else if (frameType == FrameTypeEnum.Round)
                        {
                            grid.Attributes.Frame.Type = FrameTypes.Round;
                        }
                        else if (frameType == FrameTypeEnum.Sharpened)
                        {
                            grid.Attributes.Frame.Type = FrameTypes.Sharpened;
                        }
                        else if (frameType == FrameTypeEnum.Triangle)
                        {
                            grid.Attributes.Frame.Type = FrameTypes.Triangle;
                        }
                    }

                    if (label == "LineColour")
                    {
                        grid.Attributes.Line.Color = lineColour;
                    }
                    if (label == "LineType")
                    {
                        if (lineType == LineTypeEnum.DashDot)
                        {
                            grid.Attributes.Line.Type = LineTypes.DashDot;
                        }
                        else if (lineType == LineTypeEnum.DashDoubleDot)
                        {
                            grid.Attributes.Line.Type = LineTypes.DashDoubleDot;
                        }
                        else if (lineType == LineTypeEnum.DashedLine)
                        {
                            grid.Attributes.Line.Type = LineTypes.DashedLine;
                        }
                        else if (lineType == LineTypeEnum.DottedLine)
                        {
                            grid.Attributes.Line.Type = LineTypes.DottedLine;
                        }
                        else if (lineType == LineTypeEnum.SlashDash)
                        {
                            grid.Attributes.Line.Type = LineTypes.SlashDash;
                        }
                        else if (lineType == LineTypeEnum.SlashedLine)
                        {
                            grid.Attributes.Line.Type = LineTypes.SlashedLine;
                        }
                        else if (lineType == LineTypeEnum.SolidLine)
                        {
                            grid.Attributes.Line.Type = LineTypes.SolidLine;
                        }
                        else if (lineType == LineTypeEnum.UndefinedLine)
                        {
                            grid.Attributes.Line.Type = LineTypes.UndefinedLine;
                        }
                    }
                    if (label == "OffsetAtEndOfLine")
                    {
                        grid.Attributes.OffsetAtEndOfLine = double.Parse(offsetAtEndOfLine);
                    }
                    if (label == "OffsetAtStartOfLine")
                    {
                        grid.Attributes.OffsetAtStartOfLine = double.Parse(offsetAtStartOfLine);
                    }
                    grid.Modify();
                    drawing.CommitChanges();
                }
            }
        }
示例#11
0
        public override void Handle(IClient client, Tokens tokens)
        {
            string          name                = tokens.GetString(1);
            string          nickname            = tokens.GetString(2);
            int             scrollspeed         = tokens.GetInteger(3);
            Dimension       size                = tokens.GetDimension(4);
            Point           position            = tokens.GetPoint(6);
            string          background_image    = tokens.GetString(8);
            BackgroundStyle background_style    = (BackgroundStyle)tokens.GetEnum(9);
            string          unknown             = tokens.GetString(10);
            Color           foreground          = tokens.GetColor(11);
            Color           background          = tokens.GetColor(12);
            Color           channel_red         = tokens.GetColor(13);
            Color           channel_blue        = tokens.GetColor(14);
            int             font_size           = tokens.GetInteger(15);
            int             line_height         = tokens.GetInteger(16);
            int             nicklist_font_size  = tokens.GetInteger(17);
            Color           nicklist_background = tokens.GetColor(18);
            Bool            unknown2            = tokens.GetBoolean(19);
            string          combobox_value      = tokens.GetString(20);
            Bool            combobox_visible    = tokens.GetBoolean(21);
            int             message_maximum     = tokens.GetInteger(22);
            Bool            button_help         = tokens.GetBoolean(23);
            Bool            button_report       = tokens.GetBoolean(24);
            Bool            button_feedback     = tokens.GetBoolean(25);
            Bool            button_search       = tokens.GetBoolean(26);
            string          unknown3            = tokens.GetString(27);
            string          unknown4            = tokens.GetString(28);
            Bool            unknown5            = tokens.GetBoolean(29);

            Console.WriteLine("INCOMING CHANNEL FRAME");
            Console.WriteLine("\tname = " + name);
            Console.WriteLine("\tnickname = " + nickname);
            Console.WriteLine("\tscrollspeed = " + scrollspeed);
            Console.WriteLine("\tsize = " + size.ToString());
            Console.WriteLine("\tposition = " + position.ToString());
            Console.WriteLine("\tbackground_image = " + background_image);
            Console.WriteLine("\tbackground_style = " + background_style);
            Console.WriteLine("\tunknown = " + unknown);
            Console.WriteLine("\tforeground = " + foreground.ToString());
            Console.WriteLine("\tbackground = " + background.ToString());
            Console.WriteLine("\tchannel_red = " + channel_red.ToString());
            Console.WriteLine("\tchannel_blue = " + channel_blue.ToString());
            Console.WriteLine("\tfont_size = " + font_size);
            Console.WriteLine("\tline_height = " + line_height);
            Console.WriteLine("\tnicklist_font_size = " + nicklist_font_size);
            Console.WriteLine("\tnicklist_background = " + nicklist_background.ToString());
            Console.WriteLine("\tunknown2 = " + unknown2.ToString());
            Console.WriteLine("\tcombobox_value = " + combobox_value);
            Console.WriteLine("\tcombobox_visible = " + combobox_visible.ToString());
            Console.WriteLine("\tmessage_maximum = " + message_maximum);
            Console.WriteLine("\tbutton_help = " + button_help.ToString());
            Console.WriteLine("\tbutton_report = " + button_report.ToString());
            Console.WriteLine("\tbutton_feedback = " + button_feedback.ToString());
            Console.WriteLine("\tbutton_search = " + button_search.ToString());
            Console.WriteLine("\tunknown3 = " + unknown3);
            Console.WriteLine("\tunknown4 = " + unknown4);
            Console.WriteLine("\tunknown5 = " + unknown5.ToString());

            ((Client)client.GetCore()).CreateChannelFrame(name, delegate(UI.ChannelFrame window) {
                window.SetChannel(name);
                window.SetNickname(nickname);
                window.SetSize(size);
                window.SetLocation(position);
                window.SetScrollspeed(scrollspeed);
                window.SetForeground(foreground);
                window.SetBackground(background);
                window.SetBackground(background_image, background_style);
                window.SetChannelStyle(channel_red, channel_blue);
                window.SetFontSize(font_size);
                window.SetLineHeight(line_height);
                window.SetNicklist(nicklist_font_size, nicklist_background);

                window.Show();
            });
        }
示例#12
0
        public void Modify(PropertyValueChangedEventArgs e)
        {
            string label = e.ChangedItem.Label;

            ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects();

            while (modelObjectEnum.MoveNext())
            {
                if (modelObjectEnum.Current is BoltGroup)
                {
                    BoltGroup bolt = (BoltGroup)modelObjectEnum.Current;

                    if (label == "BoltSize")
                    {
                        bolt.BoltSize = double.Parse(boltSize);
                    }
                    if (label == "BoltStandard")
                    {
                        bolt.BoltStandard = boltStandard;                          // list to sort
                    }
                    if (label == "BoltType")
                    {
                        if (boltType == BoltTypeEnum.Site)
                        {
                            bolt.BoltType = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE;
                        }
                        if (boltType == BoltTypeEnum.Workshop)
                        {
                            bolt.BoltType = BoltGroup.BoltTypeEnum.BOLT_TYPE_WORKSHOP;
                        }
                    }

                    if (label == "ThreadMaterial")
                    {
                        if (threadMaterial == ThreadMaterialEnum.No)
                        {
                            bolt.ThreadInMaterial = BoltGroup.BoltThreadInMaterialEnum.THREAD_IN_MATERIAL_NO;
                        }
                        if (threadMaterial == ThreadMaterialEnum.Yes)
                        {
                            bolt.ThreadInMaterial = BoltGroup.BoltThreadInMaterialEnum.THREAD_IN_MATERIAL_YES;
                        }
                    }

                    if (label == "CutLength")
                    {
                        bolt.CutLength = double.Parse(cutLength);
                    }
                    if (label == "ExtraLength")
                    {
                        bolt.ExtraLength = double.Parse(extraLength);
                    }
                    if (label == "BoltShaft")
                    {
                        bolt.Bolt = bool.Parse(boltShaft.ToString());
                    }
                    if (label == "Washer1")
                    {
                        bolt.Washer1 = bool.Parse(washer1.ToString());
                    }
                    if (label == "Washer2")
                    {
                        bolt.Washer2 = bool.Parse(washer2.ToString());
                    }
                    if (label == "Washer3")
                    {
                        bolt.Washer3 = bool.Parse(washer3.ToString());
                    }
                    if (label == "Nut1")
                    {
                        bolt.Nut1 = bool.Parse(nut1.ToString());
                    }
                    if (label == "Nut2")
                    {
                        bolt.Nut2 = bool.Parse(nut2.ToString());
                    }

                    if (label == "BoltDistX")
                    {
                        if (bolt is BoltArray)
                        {
                            BoltArray boltArray      = (BoltArray)bolt;
                            int       boltArrayCount = boltArray.GetBoltDistXCount();
                            for (int i = boltArrayCount - 1; i >= 0; i--)
                            {
                                boltArray.RemoveBoltDistX(i);
                                boltArray.Modify();
                            }
                            if (boltDistX != "")
                            {
                                string[] splitSpaces             = boltDistX.Split(new Char[] { ' ' });
                                System.Collections.ArrayList arr = new System.Collections.ArrayList();
                                foreach (string stringText in splitSpaces)
                                {
                                    if (stringText.Contains("*"))
                                    {
                                        string[] splitMultiplier = stringText.Split(new Char[] { '*' });
                                        for (int i = 0; i < int.Parse(splitMultiplier[0]); i++)
                                        {
                                            arr.Add(double.Parse(splitMultiplier[1].ToString()));
                                        }
                                    }
                                    else
                                    {
                                        arr.Add(double.Parse(stringText));
                                    }
                                }
                                for (int i = 0; i < arr.Count; i++)
                                {
                                    boltArray.SetBoltDistX(i, double.Parse(arr[i].ToString()));
                                }
                            }
                        }
                        else if (bolt is BoltXYList)
                        {
                            MessageBox.Show("Buggered");
                        }
                        else if (bolt is BoltCircle)
                        {
                            BoltCircle boltCircle = (BoltCircle)bolt;
                            boltCircle.NumberOfBolts = double.Parse(boltDistX);
                        }
                    }

                    if (label == "BoltDistY")
                    {
                        if (bolt is BoltArray)
                        {
                            BoltArray boltArray      = (BoltArray)bolt;
                            int       boltArrayCount = boltArray.GetBoltDistYCount();
                            for (int i = boltArrayCount - 1; i >= 0; i--)
                            {
                                boltArray.RemoveBoltDistY(i);
                                boltArray.Modify();
                            }
                            if (boltDistY != "")
                            {
                                string[] splitSpaces             = boltDistY.Split(new Char[] { ' ' });
                                System.Collections.ArrayList arr = new System.Collections.ArrayList();
                                foreach (string stringText in splitSpaces)
                                {
                                    if (stringText.Contains("*"))
                                    {
                                        string[] splitMultiplier = stringText.Split(new Char[] { '*' });
                                        for (int i = 0; i < int.Parse(splitMultiplier[0]); i++)
                                        {
                                            arr.Add(double.Parse(splitMultiplier[1].ToString()));
                                        }
                                    }
                                    else
                                    {
                                        arr.Add(double.Parse(stringText));
                                    }
                                }
                                for (int i = 0; i < arr.Count; i++)
                                {
                                    boltArray.SetBoltDistY(i, double.Parse(arr[i].ToString()));
                                }
                            }
                        }
                        else if (bolt is BoltXYList)
                        {
                            MessageBox.Show("Buggered");
                        }
                        else if (bolt is BoltCircle)
                        {
                            BoltCircle boltCircle = (BoltCircle)bolt;
                            boltCircle.Diameter = double.Parse(boltDistY);
                        }
                    }

                    if (label == "Tolerance")
                    {
                        bolt.Tolerance = double.Parse(tolerance);
                    }
                    if (label == "HoleType")
                    {
                        if (holeType == HoleTypeEnum.Slotted)
                        {
                            bolt.HoleType = BoltGroup.BoltHoleTypeEnum.HOLE_TYPE_SLOTTED;
                        }
                        if (holeType == HoleTypeEnum.Oversized)
                        {
                            bolt.HoleType = BoltGroup.BoltHoleTypeEnum.HOLE_TYPE_OVERSIZED;
                        }
                    }

                    if (label == "SlottedHoleX")
                    {
                        bolt.SlottedHoleX = double.Parse(slottedHoleX);
                    }
                    if (label == "SlottedHoleY")
                    {
                        bolt.SlottedHoleY = double.Parse(slottedHoleY);
                    }
                    if (label == "RotateSlots")
                    {
                        if (rotateSlots == RotateSlotEnum.Even)
                        {
                            bolt.RotateSlots = BoltGroup.BoltRotateSlotsEnum.ROTATE_SLOTS_EVEN;
                        }
                        if (rotateSlots == RotateSlotEnum.Odd)
                        {
                            bolt.RotateSlots = BoltGroup.BoltRotateSlotsEnum.ROTATE_SLOTS_ODD;
                        }
                        if (rotateSlots == RotateSlotEnum.Parallel)
                        {
                            bolt.RotateSlots = BoltGroup.BoltRotateSlotsEnum.ROTATE_SLOTS_PARALLEL;
                        }
                    }

                    if (label == "Hole1")
                    {
                        bolt.Hole1 = bool.Parse(hole1.ToString());
                    }
                    if (label == "Hole2")
                    {
                        bolt.Hole2 = bool.Parse(hole2.ToString());
                    }
                    if (label == "Hole3")
                    {
                        bolt.Hole3 = bool.Parse(hole3.ToString());
                    }
                    if (label == "Hole4")
                    {
                        bolt.Hole4 = bool.Parse(hole4.ToString());
                    }
                    if (label == "Hole5")
                    {
                        bolt.Hole5 = bool.Parse(hole5.ToString());
                    }
                    if (label == "OffsetFromStartX")
                    {
                        bolt.StartPointOffset.Dx = double.Parse(offsetFromStartX);
                    }
                    if (label == "OffsetFromStartY")
                    {
                        bolt.StartPointOffset.Dy = double.Parse(offsetFromStartY);
                    }
                    if (label == "OffsetFromStartZ")
                    {
                        bolt.StartPointOffset.Dz = double.Parse(offsetFromStartZ);
                    }
                    if (label == "OffsetFromEndX")
                    {
                        bolt.EndPointOffset.Dx = double.Parse(offsetFromEndX);
                    }
                    if (label == "OffsetFromEndY")
                    {
                        bolt.EndPointOffset.Dy = double.Parse(offsetFromEndY);
                    }
                    if (label == "OffsetFromEndZ")
                    {
                        bolt.EndPointOffset.Dz = double.Parse(offsetFromEndZ);
                    }
                    if (label == "PositionOnPlaneOffset")
                    {
                        bolt.Position.PlaneOffset = double.Parse(positionOnPlaneOffset);
                    }
                    if (label == "PositionRotation")
                    {
                        if (positionRotation == PositionRotationEnum.Back)
                        {
                            bolt.Position.Rotation = Position.RotationEnum.BACK;
                        }
                        if (positionRotation == PositionRotationEnum.Below)
                        {
                            bolt.Position.Rotation = Position.RotationEnum.BELOW;
                        }
                        if (positionRotation == PositionRotationEnum.Front)
                        {
                            bolt.Position.Rotation = Position.RotationEnum.FRONT;
                        }
                        if (positionRotation == PositionRotationEnum.Top)
                        {
                            bolt.Position.Rotation = Position.RotationEnum.TOP;
                        }
                    }

                    if (label == "PositionRotationOffset")
                    {
                        bolt.Position.RotationOffset = double.Parse(positionRotationOffset);
                    }
                    if (label == "At Depth Offset")
                    {
                        bolt.Position.DepthOffset = double.Parse(positionAtDepthOffset);
                    }

                    bolt.Modify();
                }
            }
        }
示例#13
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.Part)
                {
                    Tekla.Structures.Drawing.Part drawingPart = (Tekla.Structures.Drawing.Part)drawingObjectEnum.Current;
                    if (label == "DrawCenterLine")
                    {
                        drawingPart.Attributes.DrawCenterLine = bool.Parse(drawCenterLine.ToString());
                    }
                    if (label == "DrawChamfers")
                    {
                        drawingPart.Attributes.DrawChamfers = bool.Parse(drawChamfers.ToString());
                    }
                    //if (label == "Draw Connecting Side Marks") drawingPart.Attributes.DrawConnectingSideMarks = drawConnectingSideMarks;
                    if (label == "DrawHiddenLines")
                    {
                        drawingPart.Attributes.DrawHiddenLines = bool.Parse(drawHiddenLines.ToString());
                    }
                    if (label == "DrawOrientationMark")
                    {
                        drawingPart.Attributes.DrawOrientationMark = bool.Parse(drawOrientationMark.ToString());
                    }
                    if (label == "DrawOwnHiddenLines")
                    {
                        drawingPart.Attributes.DrawOwnHiddenLines = bool.Parse(drawOwnHiddenLines.ToString());
                    }
                    if (label == "DrawPopMarks")
                    {
                        drawingPart.Attributes.DrawPopMarks = bool.Parse(drawPopMarks.ToString());
                    }
                    if (label == "DrawReferenceLine")
                    {
                        drawingPart.Attributes.DrawReferenceLine = bool.Parse(drawReferenceLine.ToString());
                    }
                    if (label == "VisibleLinesColour")
                    {
                        drawingPart.Attributes.VisibleLines.Color = visibleLinesColour;
                    }
                    if (label == "VisibleLinesType")
                    {
                        if (visibleLinesType == LineTypeEnum.DashDot)
                        {
                            drawingPart.Attributes.VisibleLines.Type = LineTypes.DashDot;
                        }
                        else if (visibleLinesType == LineTypeEnum.DashDoubleDot)
                        {
                            drawingPart.Attributes.VisibleLines.Type = LineTypes.DashDoubleDot;
                        }
                        else if (visibleLinesType == LineTypeEnum.DashedLine)
                        {
                            drawingPart.Attributes.VisibleLines.Type = LineTypes.DashedLine;
                        }
                        else if (visibleLinesType == LineTypeEnum.DottedLine)
                        {
                            drawingPart.Attributes.VisibleLines.Type = LineTypes.DottedLine;
                        }
                        else if (visibleLinesType == LineTypeEnum.SlashDash)
                        {
                            drawingPart.Attributes.VisibleLines.Type = LineTypes.SlashDash;
                        }
                        else if (visibleLinesType == LineTypeEnum.SlashedLine)
                        {
                            drawingPart.Attributes.VisibleLines.Type = LineTypes.SlashedLine;
                        }
                        else if (visibleLinesType == LineTypeEnum.SolidLine)
                        {
                            drawingPart.Attributes.VisibleLines.Type = LineTypes.SolidLine;
                        }
                        else if (visibleLinesType == LineTypeEnum.UndefinedLine)
                        {
                            drawingPart.Attributes.VisibleLines.Type = LineTypes.UndefinedLine;
                        }
                    }
                    if (label == "HiddenLinesColour")
                    {
                        drawingPart.Attributes.HiddenLines.Color = hiddenLinesColour;
                    }
                    if (label == "HiddenLinesType")
                    {
                        if (hiddenLinesType == LineTypeEnum.DashDot)
                        {
                            drawingPart.Attributes.HiddenLines.Type = LineTypes.DashDot;
                        }
                        else if (hiddenLinesType == LineTypeEnum.DashDoubleDot)
                        {
                            drawingPart.Attributes.HiddenLines.Type = LineTypes.DashDoubleDot;
                        }
                        else if (hiddenLinesType == LineTypeEnum.DashedLine)
                        {
                            drawingPart.Attributes.HiddenLines.Type = LineTypes.DashedLine;
                        }
                        else if (hiddenLinesType == LineTypeEnum.DottedLine)
                        {
                            drawingPart.Attributes.HiddenLines.Type = LineTypes.DottedLine;
                        }
                        else if (hiddenLinesType == LineTypeEnum.SlashDash)
                        {
                            drawingPart.Attributes.HiddenLines.Type = LineTypes.SlashDash;
                        }
                        else if (hiddenLinesType == LineTypeEnum.SlashedLine)
                        {
                            drawingPart.Attributes.HiddenLines.Type = LineTypes.SlashedLine;
                        }
                        else if (hiddenLinesType == LineTypeEnum.SolidLine)
                        {
                            drawingPart.Attributes.HiddenLines.Type = LineTypes.SolidLine;
                        }
                        else if (hiddenLinesType == LineTypeEnum.UndefinedLine)
                        {
                            drawingPart.Attributes.HiddenLines.Type = LineTypes.UndefinedLine;
                        }
                    }
                    if (label == "ReferenceLinesColour")
                    {
                        drawingPart.Attributes.ReferenceLine.Color = referenceLinesColour;
                    }
                    if (label == "ReferenceLinesType")
                    {
                        if (referenceLinesType == LineTypeEnum.DashDot)
                        {
                            drawingPart.Attributes.ReferenceLine.Type = LineTypes.DashDot;
                        }
                        else if (referenceLinesType == LineTypeEnum.DashDoubleDot)
                        {
                            drawingPart.Attributes.ReferenceLine.Type = LineTypes.DashDoubleDot;
                        }
                        else if (referenceLinesType == LineTypeEnum.DashedLine)
                        {
                            drawingPart.Attributes.ReferenceLine.Type = LineTypes.DashedLine;
                        }
                        else if (referenceLinesType == LineTypeEnum.DottedLine)
                        {
                            drawingPart.Attributes.ReferenceLine.Type = LineTypes.DottedLine;
                        }
                        else if (referenceLinesType == LineTypeEnum.SlashDash)
                        {
                            drawingPart.Attributes.ReferenceLine.Type = LineTypes.SlashDash;
                        }
                        else if (referenceLinesType == LineTypeEnum.SlashedLine)
                        {
                            drawingPart.Attributes.ReferenceLine.Type = LineTypes.SlashedLine;
                        }
                        else if (referenceLinesType == LineTypeEnum.SolidLine)
                        {
                            drawingPart.Attributes.ReferenceLine.Type = LineTypes.SolidLine;
                        }
                        else if (referenceLinesType == LineTypeEnum.UndefinedLine)
                        {
                            drawingPart.Attributes.ReferenceLine.Type = LineTypes.UndefinedLine;
                        }
                    }
                    drawingPart.Modify();
                    drawing.CommitChanges();
                }
            }
        }
示例#14
0
        public void Modify(PropertyValueChangedEventArgs e)
        {
            try
            {
                string  label   = e.ChangedItem.Label;
                Drawing drawing = drawingHandler.GetActiveDrawing();
                DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected();
                while (drawingObjectEnum.MoveNext())
                {
                    if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Text)
                    {
                        Tekla.Structures.Drawing.Text text = (Tekla.Structures.Drawing.Text)drawingObjectEnum.Current;

                        if (label == "PreferredPlacingType")
                        {
                            Text.TextAttributes textAttributes = text.Attributes;
                            if (preferredPlacingType == PreferredPlacingEnum.PointPlacingType)
                            {
                                textAttributes.PreferredPlacing = PreferredPlacingTypes.PointPlacingType();
                            }
                            else if (preferredPlacingType == PreferredPlacingEnum.LeaderLinePlacingType)
                            {
                                textAttributes.PreferredPlacing = PreferredPlacingTypes.LeaderLinePlacingType();
                            }
                        }

                        if (label == "TextString")
                        {
                            string   formattedText = "";
                            string[] split         = textString.Split(new char[] { '¬' });
                            foreach (string temp in split)
                            {
                                formattedText = formattedText + temp + Environment.NewLine;
                            }

                            formattedText   = formattedText.Trim();
                            text.TextString = formattedText;
                        }

                        if (label == "FontColour")
                        {
                            text.Attributes.Font.Color = fontColour;
                        }
                        if (label == "FontHeight")
                        {
                            text.Attributes.Font.Height = double.Parse(fontHeight);
                        }
                        if (label == "FontName")
                        {
                            text.Attributes.Font.Name = fontName;
                        }
                        if (label == "FontBold")
                        {
                            text.Attributes.Font.Bold = bool.Parse(fontBold.ToString());
                        }
                        if (label == "FontItalic")
                        {
                            text.Attributes.Font.Italic = bool.Parse(fontItalic.ToString());
                        }
                        if (label == "TextAngle")
                        {
                            text.Attributes.Angle = double.Parse(textAngle);
                        }
                        if (label == "TextAlignment")
                        {
                            if (textAlignment == TextAlignmentEnum.Center)
                            {
                                text.Attributes.Alignment = Tekla.Structures.Drawing.TextAlignment.Center;
                            }
                            else if (textAlignment == TextAlignmentEnum.Left)
                            {
                                text.Attributes.Alignment = Tekla.Structures.Drawing.TextAlignment.Left;
                            }
                            else if (textAlignment == TextAlignmentEnum.Right)
                            {
                                text.Attributes.Alignment = Tekla.Structures.Drawing.TextAlignment.Right;
                            }
                        }

                        if (label == "FrameType")
                        {
                            if (frameType == FrameTypeEnum.Circle)
                            {
                                text.Attributes.Frame.Type = FrameTypes.Circle;
                            }
                            else if (frameType == FrameTypeEnum.Diamond)
                            {
                                text.Attributes.Frame.Type = FrameTypes.Diamond;
                            }
                            else if (frameType == FrameTypeEnum.Hexagon)
                            {
                                text.Attributes.Frame.Type = FrameTypes.Hexagon;
                            }
                            else if (frameType == FrameTypeEnum.Line)
                            {
                                text.Attributes.Frame.Type = FrameTypes.Line;
                            }
                            else if (frameType == FrameTypeEnum.None)
                            {
                                text.Attributes.Frame.Type = FrameTypes.None;
                            }
                            else if (frameType == FrameTypeEnum.Rectangular)
                            {
                                text.Attributes.Frame.Type = FrameTypes.Rectangular;
                            }
                            else if (frameType == FrameTypeEnum.Round)
                            {
                                text.Attributes.Frame.Type = FrameTypes.Round;
                            }
                            else if (frameType == FrameTypeEnum.Sharpened)
                            {
                                text.Attributes.Frame.Type = FrameTypes.Sharpened;
                            }
                            else if (frameType == FrameTypeEnum.Triangle)
                            {
                                text.Attributes.Frame.Type = FrameTypes.Triangle;
                            }
                        }

                        if (label == "FrameColour")
                        {
                            text.Attributes.Frame.Color = frameColour;
                        }
                        if (label == "ArrowheadType")
                        {
                            if (arrowheadType == ArrowheadTypeEnum.CircleArrow)
                            {
                                text.Attributes.ArrowHead.Head = ArrowheadTypes.CircleArrow;
                            }
                            else if (arrowheadType == ArrowheadTypeEnum.FilledArrow)
                            {
                                text.Attributes.ArrowHead.Head = ArrowheadTypes.FilledArrow;
                            }
                            else if (arrowheadType == ArrowheadTypeEnum.FilledCircleArrow)
                            {
                                text.Attributes.ArrowHead.Head = ArrowheadTypes.FilledCircleArrow;
                            }
                            else if (arrowheadType == ArrowheadTypeEnum.LineArrow)
                            {
                                text.Attributes.ArrowHead.Head = ArrowheadTypes.LineArrow;
                            }
                        }

                        if (label == "ArrowheadPosition")
                        {
                            if (arrowheadPosition == ArrowheadPositionEnum.Both)
                            {
                                text.Attributes.ArrowHead.ArrowPosition = ArrowheadPositions.Both;
                            }
                            else if (arrowheadPosition == ArrowheadPositionEnum.End)
                            {
                                text.Attributes.ArrowHead.ArrowPosition = ArrowheadPositions.End;
                            }
                            else if (arrowheadPosition == ArrowheadPositionEnum.None)
                            {
                                text.Attributes.ArrowHead.ArrowPosition = ArrowheadPositions.None;
                            }
                            else if (arrowheadPosition == ArrowheadPositionEnum.Start)
                            {
                                text.Attributes.ArrowHead.ArrowPosition = ArrowheadPositions.Start;
                            }
                        }

                        if (label == "ArrowheadWidth")
                        {
                            text.Attributes.ArrowHead.Width = double.Parse(arrowheadWidth);
                        }
                        if (label == "ArrowheadHeight")
                        {
                            text.Attributes.ArrowHead.Height = double.Parse(arrowheadHeight);
                        }
                        text.Modify();
                        drawing.CommitChanges();
                    }
                }
            }
            catch { }
        }