public static void Main(string[] args)
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            string visioStencil = dataDir + "Basic Shapes.vss";
            // Create a new diagram.
            Diagram diagram = new Diagram(visioStencil);

            //Add a new rectangle shape.
            long shapeId = diagram.AddShape(
                4.25, 5.5, 2, 1, @"Rectangle", 0);
            Shape shape = diagram.Pages[0].Shapes.GetShape(shapeId);
            shape.Text.Value.Add(new Txt(@"Rectangle text."));

            //Add a new star shape.
            shapeId = diagram.AddShape(
                2.0, 5.5, 2, 2, @"Star 7", 0);
            shape = diagram.Pages[0].Shapes.GetShape(shapeId);
            shape.Text.Value.Add(new Txt(@"Star text."));

            //Add a new hexagon shape.
            shapeId = diagram.AddShape(
                7.0, 5.5, 2, 2, @"Hexagon", 0);
            shape = diagram.Pages[0].Shapes.GetShape(shapeId);
            shape.Text.Value.Add(new Txt(@"Hexagon text."));

            //Save the new diagram.
            diagram.Save(dataDir + "Drawing1.vdx", SaveFileFormat.VDX);

            // Display Status.
            System.Console.WriteLine("Diagram created and saved successfully.");
        }
        static void Main(string[] args)
        {
            string FilePath     = @"..\..\..\..\Sample Files\";
            string srcFileName  = FilePath + "Sample Diagram.vsdx";
            string destFileName = FilePath + "Output.vdx";

            // Create a new diagram
            Diagram diagram = new Diagram(srcFileName);

            //Add a new rectangle shape
            long shapeId = diagram.AddShape(
                4.25, 5.5, 2, 1, @"Rectangle", 0);
            Shape shape = diagram.Pages[0].Shapes.GetShape(shapeId);

            shape.Text.Value.Add(new Txt(@"Rectangle text."));

            //Add a new star shape
            shapeId = diagram.AddShape(
                2.0, 5.5, 2, 2, @"Star 7", 0);
            shape = diagram.Pages[0].Shapes.GetShape(shapeId);
            shape.Text.Value.Add(new Txt(@"Star text."));

            //Add a new hexagon shape
            shapeId = diagram.AddShape(
                7.0, 5.5, 2, 2, @"Hexagon", 0);
            shape = diagram.Pages[0].Shapes.GetShape(shapeId);
            shape.Text.Value.Add(new Txt(@"Hexagon text."));

            //Save the new diagram
            diagram.Save(destFileName, SaveFileFormat.VDX);
        }
        public static void Run() 
        {
            // ExStart:CreatingDiagramWithAspose
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_KnowledgeBase();

            // Create a new diagram
            Diagram diagram = new Diagram(dataDir + "Basic Shapes.vss");

            // Add a new rectangle shape
            long shapeId = diagram.AddShape(4.25, 5.5, 2, 1, @"Rectangle", 0);
            Shape shape = diagram.Pages[0].Shapes.GetShape(shapeId);
            shape.Text.Value.Add(new Txt(@"Rectangle text."));

            // Add a new star shape
            shapeId = diagram.AddShape(2.0, 5.5, 2, 2, @"Star 7", 0);
            shape = diagram.Pages[0].Shapes.GetShape(shapeId);
            shape.Text.Value.Add(new Txt(@"Star text."));

            // Add a new hexagon shape
            shapeId = diagram.AddShape(7.0, 5.5, 2, 2, @"Hexagon", 0);
            shape = diagram.Pages[0].Shapes.GetShape(shapeId);
            shape.Text.Value.Add(new Txt(@"Hexagon text."));

            // Save the new diagram
            diagram.Save(dataDir + "CreatingDiagramWithAspose_out.vdx", SaveFileFormat.VDX);
            // ExEnd:CreatingDiagramWithAspose
        }
Example #4
0
        public static void Run()
        {
            //ExStart:CreatingDiagramWithAspose
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_KnowledgeBase();

            // Create a new diagram
            Diagram diagram = new Diagram(dataDir + "Basic Shapes.vss");

            //Add a new rectangle shape
            long  shapeId = diagram.AddShape(4.25, 5.5, 2, 1, @"Rectangle", 0);
            Shape shape   = diagram.Pages[0].Shapes.GetShape(shapeId);

            shape.Text.Value.Add(new Txt(@"Rectangle text."));

            //Add a new star shape
            shapeId = diagram.AddShape(2.0, 5.5, 2, 2, @"Star 7", 0);
            shape   = diagram.Pages[0].Shapes.GetShape(shapeId);
            shape.Text.Value.Add(new Txt(@"Star text."));

            //Add a new hexagon shape
            shapeId = diagram.AddShape(7.0, 5.5, 2, 2, @"Hexagon", 0);
            shape   = diagram.Pages[0].Shapes.GetShape(shapeId);
            shape.Text.Value.Add(new Txt(@"Hexagon text."));

            //Save the new diagram
            diagram.Save(dataDir + "CreatingDiagramWithAspose_Out.vdx", SaveFileFormat.VDX);
            //ExEnd:CreatingDiagramWithAspose
        }
        static void Main(string[] args)
        {
            string visioStencil = "sample.vss";
            // Create a new diagram
            Diagram diagram = new Diagram(visioStencil);

            //Add a new rectangle shape
            long shapeId = diagram.AddShape(
                4.25, 5.5, 2, 1, @"Rectangle", 0);
            Shape shape = diagram.Pages[0].Shapes.GetShape(shapeId);
            shape.Text.Value.Add(new Txt(@"Rectangle text."));

            //Add a new star shape
            shapeId = diagram.AddShape(
                2.0, 5.5, 2, 2, @"Star 7", 0);
            shape = diagram.Pages[0].Shapes.GetShape(shapeId);
            shape.Text.Value.Add(new Txt(@"Star text."));

            //Add a new hexagon shape
            shapeId = diagram.AddShape(
              7.0, 5.5, 2, 2, @"Hexagon", 0);
            shape = diagram.Pages[0].Shapes.GetShape(shapeId);
            shape.Text.Value.Add(new Txt(@"Hexagon text."));

            //Save the new diagram
            diagram.Save("Drawing1.vdx", SaveFileFormat.VDX);
        }
Example #6
0
        public static void Run()
        {
            //ExStart:ConnectVisioSubShapes
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Shapes();

            // set sub shape ids
            long shapeFromId = 2;
            long shapeToId   = 4;

            // load diagram
            Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
            // access a particular page
            Page page = diagram.Pages.GetPage("Page-3");

            // initialize connector shape
            Shape shape = new Shape();

            shape.Line.EndArrow.Value   = 4;
            shape.Line.LineWeight.Value = 0.01388;

            // add shape
            long connecter1Id = diagram.AddShape(shape, "Dynamic connector", page.ID);

            // connect sub-shapes
            page.ConnectShapesViaConnector(shapeFromId, ConnectionPointPlace.Right, shapeToId, ConnectionPointPlace.Left, connecter1Id);
            // save Visio drawing
            diagram.Save(dataDir + "ConnectVisioSubShapes_Out.vsdx", SaveFileFormat.VSDX);
            //ExEnd:ConnectVisioSubShapes
        }
Example #7
0
        static void Main(string[] args)
        {
            string FilePath     = @"..\..\..\..\Sample Files\";
            string srcFileName  = FilePath + "Sample Diagram.vsdx";
            string destFileName = FilePath + "Output.vdx";

            // Load masters from any existing diagram, stencil or template
            // and add in the new diagram

            //Names of the masters present in the stencil
            string rectangleMaster = @"Rectangle";

            int    pageNumber = 0;
            double width = 2, height = 2, pinX = 4.25, pinY = 9.5;

            // Create a new diagram
            Diagram diagram = new Diagram(srcFileName);

            //Add a new rectangle shape
            long rectangleId = diagram.AddShape(
                pinX, pinY, width, height, rectangleMaster, pageNumber);

            //Save the diagram
            diagram.Save(destFileName, SaveFileFormat.VDX);
        }
        public static void Run()
        {
            // ExStart:ConnectVisioSubShapes
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Shapes();

            // Set sub shape ids
            long shapeFromId = 2;
            long shapeToId = 4;

            // Load diagram
            Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
            // Access a particular page
            Page page = diagram.Pages.GetPage("Page-3");
           
            // Initialize connector shape
            Shape shape = new Shape();
            shape.Line.EndArrow.Value = 4;
            shape.Line.LineWeight.Value = 0.01388;

            // Add shape
            long connecter1Id = diagram.AddShape(shape, "Dynamic connector", page.ID);
            // Connect sub-shapes
            page.ConnectShapesViaConnector(shapeFromId, ConnectionPointPlace.Right, shapeToId, ConnectionPointPlace.Left, connecter1Id);
            // Save Visio drawing
            diagram.Save(dataDir + "ConnectVisioSubShapes_out.vsdx", SaveFileFormat.VSDX);
            // ExEnd:ConnectVisioSubShapes
        }
Example #9
0
        public static void Run()
        {
            //ExStart:RefreshMilestoneWithMilestoneHelper
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Shapes();

            string pageName = @"Page-1";

            ////////////// Modify time line ///////////
            DateTime startDate = new DateTime(2015, 8, 1);

            DateTime endDate = new DateTime(2016, 6, 1);

            DateTime fisYear = startDate;

            //Load a diagram
            Diagram diagram = new Diagram(dataDir + "input.vdx");

            //Get page
            Aspose.Diagram.Page page = diagram.Pages.GetPage(pageName);

            long timelineId = 1;

            Shape timeline = diagram.Pages.GetPage(pageName).Shapes.GetShape(timelineId);

            double xpos = timeline.XForm.PinX.Value;

            double ypos = timeline.XForm.PinY.Value;

            // Add milestone
            string milestoneMasterName = "2 triangle milestone";

            //Add Master
            diagram.AddMaster(dataDir + "Timeline.vss", milestoneMasterName);

            //Add Shape in Visio diagram using AddShape method
            long milestoneShapeId = diagram.AddShape(xpos, ypos, milestoneMasterName, 0);

            //Get the shape based on ID
            Shape milestone = page.Shapes.GetShape(milestoneShapeId);

            //Instantiate MilestoneHelper object
            MilestoneHelper milestoneHelper = new MilestoneHelper(milestone);

            //Set Milestone Date
            milestoneHelper.MilestoneDate = new DateTime(2015, 8, 1);

            //Set IsAutoUpdate to true
            milestoneHelper.IsAutoUpdate = true;

            //RefreshMilesone of timeline shape
            milestoneHelper.RefreshMilestone(timeline);

            //Save Visio file
            diagram.Save(dataDir + "output.vdx", SaveFileFormat.VDX);
            //ExEnd:RefreshMilestoneWithMilestoneHelper
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Shapes();

            string pageName = @"Page-1";

            ////////////// Modify time line ///////////
            DateTime startDate = new DateTime(2015, 8, 1);

            DateTime endDate = new DateTime(2016, 6, 1);

            DateTime fisYear = startDate;

            //Load a diagram
            Diagram diagram = new Diagram(dataDir + "input.vdx");

            //Get page
            Aspose.Diagram.Page page = diagram.Pages.GetPage(pageName);

            long timelineId = 1;

            Shape timeline = diagram.Pages.GetPage(pageName).Shapes.GetShape(timelineId);

            double xpos = timeline.XForm.PinX.Value;

            double ypos = timeline.XForm.PinY.Value;

            // Add milestone
            string milestoneMasterName = "2 triangle milestone";

            //Add Master
            diagram.AddMaster(dataDir + "Timeline.vss", milestoneMasterName);

            //Add Shape in Visio diagram using AddShape method
            long milestoneShapeId = diagram.AddShape(xpos, ypos, milestoneMasterName, 0);

            //Get the shape based on ID
            Shape milestone = page.Shapes.GetShape(milestoneShapeId);

            //Instantiate MilestoneHelper object
            MilestoneHelper milestoneHelper = new MilestoneHelper(milestone);

            //Set Milestone Date
            milestoneHelper.MilestoneDate = new DateTime(2015, 8, 1);

            //Set IsAutoUpdate to true
            milestoneHelper.IsAutoUpdate = true;

            //RefreshMilesone of timeline shape
            milestoneHelper.RefreshMilestone(timeline);

            //Save Visio file
            diagram.Save(dataDir + "output.vdx", SaveFileFormat.VDX);
        }
Example #11
0
        public static void Run()
        {
            //ExStart:AddMasterFromStencil
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Master();

            // Load diagram
            Diagram diagram = new Diagram();

            // Load stencil to a stream
            string templateFileName = dataDir + "NetApp-FAS-series.vss";
            Stream stream           = new FileStream(templateFileName, FileMode.Open);

            // Add master with stencil file path and master id
            string masterName = "FAS80xx rear empty";

            diagram.AddMaster(templateFileName, 2);

            // Add master with stencil file path and master name
            diagram.AddMaster(templateFileName, masterName);

            // Add master with stencil file stream and master id
            diagram.AddMaster(stream, 2);

            // adds master to diagram from source diagram
            Diagram src = new Diagram(templateFileName);

            diagram.AddMaster(src, masterName);

            // Add master with stencil file stream and master id
            diagram.AddMaster(stream, masterName);

            // Adds shape with defined PinX and PinY.
            diagram.AddShape(2.0, 2.0, masterName, 0);
            diagram.AddShape(6.0, 6.0, masterName, 0);

            // Adds shape with defined PinX,PinY,Width and Height.
            diagram.AddShape(7.0, 3.0, 1.5, 1.5, masterName, 0);
            //ExEnd:AddMasterFromStencil
        }
        public static void Run()
        {
            // ExStart:AddMasterFromStencil
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Master();

            // Load diagram
            Diagram diagram = new Diagram();

            // Load stencil to a stream
            string templateFileName = dataDir + "NetApp-FAS-series.vss";
            Stream stream = new FileStream(templateFileName, FileMode.Open);

            // Add master with stencil file path and master id
            string masterName = "FAS80xx rear empty";
            diagram.AddMaster(templateFileName, 2);

            // Add master with stencil file path and master name
            diagram.AddMaster(templateFileName, masterName);

            // Add master with stencil file stream and master id
            diagram.AddMaster(stream, 2);

            // Adds master to diagram from source diagram
            Diagram src = new Diagram(templateFileName);
            diagram.AddMaster(src, masterName);

            // Add master with stencil file stream and master id
            diagram.AddMaster(stream, masterName);

            // Adds shape with defined PinX and PinY.
            diagram.AddShape(2.0, 2.0, masterName, 0);
            diagram.AddShape(6.0, 6.0, masterName, 0);

            // Adds shape with defined PinX,PinY,Width and Height.
            diagram.AddShape(7.0, 3.0, 1.5, 1.5, masterName, 0);
            // ExEnd:AddMasterFromStencil
        }
        public static void Run()
        {
            // ExStart:AddingNewShape
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Shapes();

            // Load a diagram
            Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
            // Get page by name
            Page page = diagram.Pages.GetPage("Page-2");

            // Add master with stencil file path and master name
            string masterName = "Rectangle";

            diagram.AddMaster(dataDir + "Basic Shapes.vss", masterName);

            // Page indexing starts from 0
            int    PageIndex = 1;
            double width = 2, height = 2, pinX = 4.25, pinY = 4.5;
            // Add a new rectangle shape
            long rectangleId = diagram.AddShape(pinX, pinY, width, height, masterName, PageIndex);

            // Set shape properties
            Shape rectangle = page.Shapes.GetShape(rectangleId);

            rectangle.XForm.PinX.Value = 5;
            rectangle.XForm.PinY.Value = 5;
            rectangle.Type             = TypeValue.Shape;
            rectangle.Text.Value.Add(new Txt("Aspose Diagram"));
            rectangle.TextStyle              = diagram.StyleSheets[3];
            rectangle.Line.LineColor.Value   = "#ff0000";
            rectangle.Line.LineWeight.Value  = 0.03;
            rectangle.Line.Rounding.Value    = 0.1;
            rectangle.Fill.FillBkgnd.Value   = "#ff00ff";
            rectangle.Fill.FillForegnd.Value = "#ebf8df";

            /* refreshes shape's position, including XForm, TextXForm, connection and geom data
             * when changing the shape's text and other's*/
            rectangle.RefreshData();
            diagram.Save(dataDir + "AddShape_out.vsdx", SaveFileFormat.VSDX);
            Console.WriteLine("Shape has been added.");
            // ExEnd:AddingNewShape
        }
Example #14
0
        private void InitializeFirstPage()
        {
            var pageViewModel = new PageViewModel()
            {
                PageNumber = 1,
                Top        = 0,
                Bottom     = DefaultPageHeight
            };

            var marginShape = new MarginShape
            {
                Position    = new Point(_margin.Left, _margin.Top),
                DataContext = pageViewModel
            };

            marginShape.Loaded += UpdateMarginsShape;

            _marginShapes.Add(marginShape);
            _reportViewModel.Pages.Add(pageViewModel);

            Diagram.AddShape(marginShape);
        }
        public static void Run()
        {
            // ExStart:AddingNewShape
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Shapes();

            // Load a diagram
            Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
            // Get page by name
            Page page = diagram.Pages.GetPage("Page-2");

            // Add master with stencil file path and master name
            string masterName = "Rectangle";
            diagram.AddMaster(dataDir + "Basic Shapes.vss", masterName);
            
            // Page indexing starts from 0
            int PageIndex = 1;
            double width = 2, height = 2, pinX = 4.25, pinY = 4.5;
            // Add a new rectangle shape
            long rectangleId = diagram.AddShape(pinX, pinY, width, height, masterName, PageIndex);
            
            // Set shape properties 
            Shape rectangle = page.Shapes.GetShape(rectangleId);
            rectangle.XForm.PinX.Value = 5;
            rectangle.XForm.PinY.Value = 5;
            rectangle.Type = TypeValue.Shape;
            rectangle.Text.Value.Add(new Txt("Aspose Diagram"));
            rectangle.TextStyle = diagram.StyleSheets[3];
            rectangle.Line.LineColor.Value = "#ff0000";
            rectangle.Line.LineWeight.Value = 0.03;
            rectangle.Line.Rounding.Value = 0.1;
            rectangle.Fill.FillBkgnd.Value = "#ff00ff";
            rectangle.Fill.FillForegnd.Value = "#ebf8df";

            diagram.Save(dataDir + "AddShape_out.vsdx", SaveFileFormat.VSDX);
            Console.WriteLine("Shape has been added.");
            // ExEnd:AddingNewShape
        }
Example #16
0
        private void NewPageButton_Click(object sender, RoutedEventArgs e)
        {
            var lastPage = _reportViewModel.Pages.Last();

            var pageViewModel = new PageViewModel()
            {
                Top        = lastPage.Bottom + 1,
                Bottom     = (lastPage.Bottom + 1) + DefaultPageHeight,
                PageNumber = lastPage.PageNumber + 1
            };

            var marginShape = new MarginShape
            {
                Position    = new Point(_margin.Left, pageViewModel.Top + _margin.Top),
                DataContext = pageViewModel
            };

            marginShape.Loaded += UpdateMarginsShape;

            _reportViewModel.Pages.Add(pageViewModel);
            _marginShapes.Add(marginShape);

            Diagram.AddShape(marginShape);
        }
        public static void Run()
        {
            //ExStart:AddConnectShapes
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Diagrams();

            //Set license (you can add 10 shapes without setting a license)
            //License lic = new License();
            //lic.SetLicense(dataDir + "Aspose.Total.lic");

            // Load masters from any existing diagram, stencil or template
            // and add in the new diagram
            string visioStencil = dataDir + "AddConnectShapes.vss";

            //Names of the masters present in the stencil
            string rectangleMaster = @"Rectangle", starMaster = @"Star 7",
                   hexagonMaster = @"Hexagon", connectorMaster = "Dynamic connector";

            int    pageNumber = 0;
            double width = 2, height = 2, pinX = 4.25, pinY = 9.5;

            // Create a new diagram
            Diagram diagram = new Diagram(visioStencil);

            //Add a new rectangle shape
            long rectangleId = diagram.AddShape(
                pinX, pinY, width, height, rectangleMaster, pageNumber);

            //Set the new shape's properties
            Shape shape = diagram.Pages[pageNumber].Shapes.GetShape(rectangleId);

            shape.Text.Value.Add(new Txt(@"Rectangle text."));
            shape.Name = "Rectangle1";
            shape.XForm.LocPinX.Ufe.F    = "Width*0.5";
            shape.XForm.LocPinY.Ufe.F    = "Height*0.5";
            shape.Line.LineColor.Value   = "7";
            shape.Line.LineWeight.Value  = 0.03;
            shape.Fill.FillBkgnd.Value   = "1";
            shape.Fill.FillForegnd.Value = "3";
            shape.Fill.FillPattern.Value = 31;

            //Add a new star shape
            pinX = 2.0;
            pinY = 4.5;
            long starId = diagram.AddShape(
                pinX, pinY, width, height, starMaster, pageNumber);

            //Set the star shape's properties
            shape = diagram.Pages[pageNumber].Shapes.GetShape(starId);
            shape.Text.Value.Add(new Txt(@"Star text."));
            shape.Name = "Star1";
            shape.XForm.LocPinX.Ufe.F    = "Width*0.5";
            shape.XForm.LocPinY.Ufe.F    = "Height*0.5";
            shape.Line.LineColor.Value   = "#ff0000";
            shape.Line.LineWeight.Value  = 0.03;
            shape.Fill.FillBkgnd.Value   = "#ff00ff";
            shape.Fill.FillForegnd.Value = "#0000ff";
            shape.Fill.FillPattern.Value = 31;

            //Add a new hexagon shape
            pinX = 7.0;
            long hexagonId = diagram.AddShape(
                pinX, pinY, width, height, hexagonMaster, pageNumber);

            //Set the hexagon shape's properties
            shape = diagram.Pages[pageNumber].Shapes.GetShape(hexagonId);
            shape.Text.Value.Add(new Txt(@"Hexagon text."));
            shape.Name = "Hexagon1";
            shape.XForm.LocPinX.Ufe.F    = "Width*0.5";
            shape.XForm.LocPinY.Ufe.F    = "Height*0.5";
            shape.Line.LineWeight.Value  = 0.03;
            shape.Fill.FillPattern.Value = 31;

            //Add master to dynamic connector from the stencil
            diagram.AddMaster(visioStencil, connectorMaster);

            //Connect rectangle and star shapes
            Shape connector1   = new Shape();
            long  connecter1Id = diagram.AddShape(connector1, connectorMaster, 0);

            diagram.Pages[0].ConnectShapesViaConnector(rectangleId, ConnectionPointPlace.Bottom,
                                                       starId, ConnectionPointPlace.Top, connecter1Id);

            //Connect rectangle and hexagon shapes
            Shape connector2   = new Shape();
            long  connecter2Id = diagram.AddShape(connector2, connectorMaster, 0);

            diagram.Pages[0].ConnectShapesViaConnector(rectangleId, ConnectionPointPlace.Bottom,
                                                       hexagonId, ConnectionPointPlace.Left, connecter2Id);

            //Save the diagram
            diagram.Save(dataDir + "Output.vdx", SaveFileFormat.VDX);
            //ExEnd:AddConnectShapes
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Diagrams();

            //Set license (you can add 10 shapes without setting a license)
            //License lic = new License();
            //lic.SetLicense(dataDir + "Aspose.Total.lic");

            // Load masters from any existing diagram, stencil or template
            // and add in the new diagram
            string visioStencil = dataDir + "AddConnectShapes.vss";

            //Names of the masters present in the stencil
            string rectangleMaster = @"Rectangle", starMaster = @"Star 7",
                hexagonMaster = @"Hexagon", connectorMaster = "Dynamic connector";

            int pageNumber = 0;
            double width = 2, height = 2, pinX = 4.25, pinY = 9.5;

            // Create a new diagram
            Diagram diagram = new Diagram(visioStencil);

            //Add a new rectangle shape
            long rectangleId = diagram.AddShape(
                pinX, pinY, width, height, rectangleMaster, pageNumber);

            //Set the new shape's properties
            Shape shape = diagram.Pages[pageNumber].Shapes.GetShape(rectangleId);
            shape.Text.Value.Add(new Txt(@"Rectangle text."));
            shape.Name = "Rectangle1";
            shape.XForm.LocPinX.Ufe.F = "Width*0.5";
            shape.XForm.LocPinY.Ufe.F = "Height*0.5";
            shape.Line.LineColor.Value = "7";
            shape.Line.LineWeight.Value = 0.03;
            shape.Fill.FillBkgnd.Value = "1";
            shape.Fill.FillForegnd.Value = "3";
            shape.Fill.FillPattern.Value = 31;

            //Add a new star shape
            pinX = 2.0;
            pinY = 4.5;
            long starId = diagram.AddShape(
                pinX, pinY, width, height, starMaster, pageNumber);

            //Set the star shape's properties
            shape = diagram.Pages[pageNumber].Shapes.GetShape(starId);
            shape.Text.Value.Add(new Txt(@"Star text."));
            shape.Name = "Star1";
            shape.XForm.LocPinX.Ufe.F = "Width*0.5";
            shape.XForm.LocPinY.Ufe.F = "Height*0.5";
            shape.Line.LineColor.Value = "#ff0000";
            shape.Line.LineWeight.Value = 0.03;
            shape.Fill.FillBkgnd.Value = "#ff00ff";
            shape.Fill.FillForegnd.Value = "#0000ff";
            shape.Fill.FillPattern.Value = 31;

            //Add a new hexagon shape
            pinX = 7.0;
            long hexagonId = diagram.AddShape(
                pinX, pinY, width, height, hexagonMaster, pageNumber);

            //Set the hexagon shape's properties
            shape = diagram.Pages[pageNumber].Shapes.GetShape(hexagonId);
            shape.Text.Value.Add(new Txt(@"Hexagon text."));
            shape.Name = "Hexagon1";
            shape.XForm.LocPinX.Ufe.F = "Width*0.5";
            shape.XForm.LocPinY.Ufe.F = "Height*0.5";
            shape.Line.LineWeight.Value = 0.03;
            shape.Fill.FillPattern.Value = 31;

            //Add master to dynamic connector from the stencil
            diagram.AddMaster(visioStencil, connectorMaster);

            //Connect rectangle and star shapes
            Shape connector1 = new Shape();
            long connecter1Id = diagram.AddShape(connector1, connectorMaster, 0);
            diagram.Pages[0].ConnectShapesViaConnector(rectangleId, ConnectionPointPlace.Bottom,
                starId, ConnectionPointPlace.Top, connecter1Id);

            //Connect rectangle and hexagon shapes
            Shape connector2 = new Shape();
            long connecter2Id = diagram.AddShape(connector2, connectorMaster, 0);
            diagram.Pages[0].ConnectShapesViaConnector(rectangleId, ConnectionPointPlace.Bottom,
                hexagonId, ConnectionPointPlace.Left, connecter2Id);

            //Save the diagram
            diagram.Save(dataDir + "Output.vdx", SaveFileFormat.VDX);
        }