Exemplo n.º 1
0
        public override void Run()
        {
            var dh = new TSD.DrawingHandler();

            dh.CloseActiveDrawing(false);

            Console.WriteLine("Getting drawings from the model...");
            var drawings = dh.GetDrawings();

            if (drawings.GetSize().Equals(0))
            {
                Console.WriteLine("There is no drawing in the opened model");
            }
            else
            {
                Console.WriteLine("There are {0} drawings. Printing first 10...\n\n", drawings.GetSize());
            }

            int i = 1;

            while (drawings.MoveNext())
            {
                var drawing = drawings.Current as TSD.Drawing;

                Console.WriteLine(i + " Mark: {4}, Name: {0}, Title1: {1}, Title2: {2}, Title3 {3}",
                                  drawing.Name, drawing.Title1, drawing.Title2, drawing.Title3, drawing.Mark);

                if (i.Equals(10))
                {
                    break;
                }
                i++;
            }
        }
Exemplo n.º 2
0
        //private static void ConvertNullable(dynamic)

        private static void OpenDrawingAndInsertLine()
        {
            var dh = new TSD.DrawingHandler();

            dh.CloseActiveDrawing(false);
            var drawings = dh.GetDrawings();

            while (drawings.MoveNext())
            {
                var drawing = drawings.Current as TSD.Drawing;
                Console.WriteLine("Name: {0}, Title1: {1}, Title2: {2}, Title3 {3}", drawing.Name, drawing.Title1, drawing.Title2, drawing.Title3);

                dh.SetActiveDrawing(drawing);

                var p1   = new Point(0, 0, 0);
                var p2   = new Point(200, 200, 0);
                var line = new TSD.Line(drawing.GetSheet(), p1, p2);
                line.Attributes = new TSD.Line.LineAttributes("standard");
                line.Insert();
                drawing.CommitChanges();

                break;
            }

            dh.CloseActiveDrawing(false);
        }