public void UnExecute()
        {
            InstanceGroup sel = MainForm.CurrentStage.Selection;

            sel.GlobalRotationCenter = prevLocation;
            MainForm.CurrentStage.InvalidateCenterPoint();
        }
Пример #2
0
        public void UnExecute()
        {
            StageView     stage = MainForm.CurrentStage;
            InstanceGroup sel   = MainForm.CurrentStage.Selection;

            uint[] ids = sel.SelectedIds;

            foreach (Bond b in addedBonds)
            {
                stage.CurrentEditItem.BondStore.RemoveBond(b);
            }

            for (int i = 0; i < ids.Length; i++)
            {
                DesignInstance di = MainForm.CurrentInstanceManager[ids[i]];

                Vex.Matrix m      = di.GetMatrix();
                Vex.Point  offset = new Vex.Point(-offsets[i].X, -offsets[i].Y);
                m.Translate(offset);
                stage.SetDesignInstanceMatrix(di, m);
            }

            if (useSmartBonds)
            {
                foreach (Bond b in previousBonds)
                {
                    stage.CurrentEditItem.BondStore.AddBond(b);
                }
            }

            sel.Update();
            MainForm.CurrentStage.ResetTransformHandles();
            MainForm.CurrentStage.InvalidateTransformedSelection();
        }
        public void GetRequestObject()
        {
            moq::Mock <RegionInstanceGroups.RegionInstanceGroupsClient> mockGrpcClient = new moq::Mock <RegionInstanceGroups.RegionInstanceGroupsClient>(moq::MockBehavior.Strict);
            GetRegionInstanceGroupRequest request = new GetRegionInstanceGroupRequest
            {
                InstanceGroup = "instance_group6bf5a5ef",
                Region        = "regionedb20d96",
                Project       = "projectaa6ff846",
            };
            InstanceGroup expectedResponse = new InstanceGroup
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                Size = -1218396681,
                Zone = "zone255f4ea8",
                CreationTimestamp = "creation_timestamp235e59a1",
                Region            = "regionedb20d96",
                Network           = "networkd22ce091",
                Fingerprint       = "fingerprint009e6052",
                Subnetwork        = "subnetworkf55bf572",
                Description       = "description2cf9da67",
                NamedPorts        = { new NamedPort(), },
                SelfLink          = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            RegionInstanceGroupsClient client = new RegionInstanceGroupsClientImpl(mockGrpcClient.Object, null);
            InstanceGroup response            = client.Get(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Пример #4
0
        public void UnExecute()
        {
            InstanceGroup sel = MainForm.CurrentStage.Selection;

            sel.Set(prevSelected);
            MainForm.CurrentStage.ResetTransformHandles();
        }
Пример #5
0
        public void Execute()
        {
            StageView     stage = MainForm.CurrentStage;
            InstanceGroup sel   = MainForm.CurrentStage.Selection;

            removeBondsCommand.Execute();
            prevSelected = sel.SelectedIds;
            stage.RemoveInstancesById(instanceIds);
            MainForm.CurrentStage.InvalidateTransformedSelection();
        }
Пример #6
0
        public void UnExecute()
        {
            StageView stage = MainForm.CurrentStage;

            InstanceGroup sel = stage.Selection;

            stage.RemoveInstancesById(instanceIds);
            sel.Set(prevSelected);
            stage.ResetTransformHandles();
            stage.InvalidateTransformedSelection();
        }
 /// <summary>Snippet for Get</summary>
 public void Get()
 {
     // Snippet: Get(string, string, string, CallSettings)
     // Create client
     RegionInstanceGroupsClient regionInstanceGroupsClient = RegionInstanceGroupsClient.Create();
     // Initialize request argument(s)
     string project       = "";
     string region        = "";
     string instanceGroup = "";
     // Make the request
     InstanceGroup response = regionInstanceGroupsClient.Get(project, region, instanceGroup);
     // End snippet
 }
Пример #8
0
 /// <summary>Snippet for Insert</summary>
 public void Insert()
 {
     // Snippet: Insert(string, string, InstanceGroup, CallSettings)
     // Create client
     InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.Create();
     // Initialize request argument(s)
     string        project = "";
     string        zone    = "";
     InstanceGroup instanceGroupResource = new InstanceGroup();
     // Make the request
     Operation response = instanceGroupsClient.Insert(project, zone, instanceGroupResource);
     // End snippet
 }
 /// <summary>Snippet for Get</summary>
 public void GetRequestObject()
 {
     // Snippet: Get(GetRegionInstanceGroupRequest, CallSettings)
     // Create client
     RegionInstanceGroupsClient regionInstanceGroupsClient = RegionInstanceGroupsClient.Create();
     // Initialize request argument(s)
     GetRegionInstanceGroupRequest request = new GetRegionInstanceGroupRequest
     {
         InstanceGroup = "",
         Region        = "",
         Project       = "",
     };
     // Make the request
     InstanceGroup response = regionInstanceGroupsClient.Get(request);
     // End snippet
 }
Пример #10
0
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertAsync()
        {
            // Snippet: InsertAsync(string, string, InstanceGroup, CallSettings)
            // Additional: InsertAsync(string, string, InstanceGroup, CancellationToken)
            // Create client
            InstanceGroupsClient instanceGroupsClient = await InstanceGroupsClient.CreateAsync();

            // Initialize request argument(s)
            string        project = "";
            string        zone    = "";
            InstanceGroup instanceGroupResource = new InstanceGroup();
            // Make the request
            Operation response = await instanceGroupsClient.InsertAsync(project, zone, instanceGroupResource);

            // End snippet
        }
        /// <summary>Snippet for GetAsync</summary>
        public async Task GetAsync()
        {
            // Snippet: GetAsync(string, string, string, CallSettings)
            // Additional: GetAsync(string, string, string, CancellationToken)
            // Create client
            RegionInstanceGroupsClient regionInstanceGroupsClient = await RegionInstanceGroupsClient.CreateAsync();

            // Initialize request argument(s)
            string project       = "";
            string region        = "";
            string instanceGroup = "";
            // Make the request
            InstanceGroup response = await regionInstanceGroupsClient.GetAsync(project, region, instanceGroup);

            // End snippet
        }
Пример #12
0
        internal InstanceGroup GetChild(int index)
        {
            int           curIndex     = 0;
            InstanceGroup currentGroup = this.child;

            while (currentGroup != null)
            {
                if (curIndex == index)
                {
                    return(currentGroup);
                }
                curIndex++;
                currentGroup = currentGroup.Sibling;
            }
            return(null);
        }
Пример #13
0
        public void PopulateData(InstanceGroup selection)
        {
            if (selection == null || selection.Count == 0)
            {
                tDefinitionName.Text = "";
                tbInstance.Text      = "";
                tbX.Text             = "";
                tbY.Text             = "";
                tbWidth.Text         = "";
                tbHeight.Text        = "";
                tbXScale.Text        = "";
                tbYScale.Text        = "";
                tbRotation.Text      = "";
                tShear.Text          = "";
            }
            else
            {
                uint[]           ids = selection.SelectedIds;
                MatrixComponents mc  = selection.TransformMatrix.VexMatrix().GetMatrixComponents();
                if (selection.Count == 1)
                {
                    DesignInstance di = MainForm.CurrentInstanceManager[ids[0]];
                    tDefinitionName.Text = di.Definition.Name;
                    tbInstance.Text      = di.InstanceName;
                }
                else
                {
                }

                tbX.Text      = selection.Location.X.ToString("0.##");
                tbY.Text      = selection.Location.Y.ToString("0.##");
                tbWidth.Text  = (selection.UntransformedBounds.Width * mc.ScaleX).ToString("0.##");
                tbHeight.Text = (selection.UntransformedBounds.Height * mc.ScaleY).ToString("0.##");

                tbXScale.Text   = mc.ScaleX.ToString("0.##");
                tbYScale.Text   = mc.ScaleY.ToString("0.##");
                tbRotation.Text = mc.Rotation.ToString("0.##");
                tShear.Text     = mc.Shear.ToString("0.##");
            }

            if (MainForm.CurrentStage != null)
            {
                btStageColor.BackColor = MainForm.CurrentStage.BackgroundColor.SysColor();
                tbStageWidth.Text      = MainForm.CurrentStage.Width.ToString();
                tbStageHeight.Text     = MainForm.CurrentStage.Height.ToString();
            }
        }
Пример #14
0
        public void UnExecute()
        {
            StageView stage = MainForm.CurrentStage;
            //DDW.Display.DesignTimeline curEditItem = stage.CurrentEditItem;
            InstanceGroup sel = stage.Selection;

            stage.RemoveInstancesById(newInstances);

            for (int i = 0; i < prevInstances.Length; i++)
            {
                stage.InsertExistingInstance(prevDepths[i], MainForm.CurrentInstanceManager[prevInstances[i]]);
            }

            sel.Set(prevSelection);
            stage.ResetTransformHandles();
            stage.InvalidateSelection();
        }
Пример #15
0
 internal void AddChild(InstanceGroup obj)
 {
     obj.Parent = this;
     if (this.child == null)
     {             //If first child
         this.child = obj;
     }
     else
     {
         InstanceGroup prev = null;
         InstanceGroup next = this.child;
         while (next != null)
         {
             prev = next;
             next = next.Sibling;
         }
         prev.Sibling = obj;
     }
 }
Пример #16
0
        public void Execute()
        {
            StageView     stage = MainForm.CurrentStage;
            InstanceGroup sel   = stage.Selection;

            prevSelected = sel.SelectedIds;
            if (instanceIds == null)
            {
                instanceIds = stage.AddInstances(libraryIds, locations);
            }
            else
            {
                stage.AddInstancesById(instanceIds);
            }

            sel.Set(instanceIds);
            stage.ResetTransformHandles();
            stage.InvalidateTransformedSelection();
        }
        /// <summary>Snippet for GetAsync</summary>
        public async Task GetRequestObjectAsync()
        {
            // Snippet: GetAsync(GetRegionInstanceGroupRequest, CallSettings)
            // Additional: GetAsync(GetRegionInstanceGroupRequest, CancellationToken)
            // Create client
            RegionInstanceGroupsClient regionInstanceGroupsClient = await RegionInstanceGroupsClient.CreateAsync();

            // Initialize request argument(s)
            GetRegionInstanceGroupRequest request = new GetRegionInstanceGroupRequest
            {
                InstanceGroup = "",
                Region        = "",
                Project       = "",
            };
            // Make the request
            InstanceGroup response = await regionInstanceGroupsClient.GetAsync(request);

            // End snippet
        }
Пример #18
0
        public void Execute()
        {
            StageView stage = MainForm.CurrentStage;

            InstanceGroup sel = stage.Selection;

            this.prevSelected = sel.SelectedIds;

            Vex.Point selRotCent = sel.GlobalRotationCenter.Translate(sel.Location.Negate());

            uint[]      libraryIds = new uint[prevSelected.Length];
            Vex.Point[] locations  = new Vex.Point[prevSelected.Length];
            for (int i = 0; i < prevSelected.Length; i++)
            {
                DesignInstance di = MainForm.CurrentInstanceManager[prevSelected[i]];
                libraryIds[i] = di.LibraryItem.DefinitionId;
                locations[i]  = new Vex.Point(di.Location.X + offset.X, di.Location.Y + offset.Y);
            }

            if (newInstanceIds == null)
            {
                newInstanceIds = stage.AddInstances(libraryIds, locations);
                for (int i = 0; i < newInstanceIds.Length; i++)
                {
                    DesignInstance oldDi = MainForm.CurrentInstanceManager[prevSelected[i]];
                    DesignInstance newDi = MainForm.CurrentInstanceManager[newInstanceIds[i]];
                    Vex.Matrix     m     = oldDi.GetMatrix();
                    stage.SetDesignInstanceMatrix(newDi, new Vex.Matrix(m.ScaleX, m.Rotate0, m.Rotate1, m.ScaleY, newDi.Location.X, newDi.Location.Y));

                    newDi.RotationCenter = oldDi.RotationCenter;
                }
            }
            else
            {
                stage.AddInstancesById(newInstanceIds);
            }

            sel.Set(newInstanceIds);
            sel.GlobalRotationCenter = selRotCent.Translate(sel.Location);
            stage.ResetTransformHandles();
            stage.InvalidateTransformedSelection();
        }
Пример #19
0
        public void Execute()
        {
            InstanceGroup sel = MainForm.CurrentStage.Selection;

            prevSelected = sel.SelectedIds;
            if (modifier == SelectionModifier.AddToSelection)
            {
                uint[] allSelected = prevSelected.Union(instanceIds).ToArray <uint>();
                sel.Set(allSelected);
            }
            else if (modifier == SelectionModifier.SubtractFromSelection)
            {
                uint[] allSelected = prevSelected.Except(instanceIds).ToArray <uint>();
                sel.Set(allSelected);
            }
            else
            {
                sel.Set(instanceIds);
                MainForm.CurrentStage.ResetTransformHandles();
            }
        }
Пример #20
0
        public async stt::Task GetRequestObjectAsync()
        {
            moq::Mock <InstanceGroups.InstanceGroupsClient> mockGrpcClient = new moq::Mock <InstanceGroups.InstanceGroupsClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForZoneOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetInstanceGroupRequest request = new GetInstanceGroupRequest
            {
                Zone          = "zone255f4ea8",
                InstanceGroup = "instance_group6bf5a5ef",
                Project       = "projectaa6ff846",
            };
            InstanceGroup expectedResponse = new InstanceGroup
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                Size = -1218396681,
                Zone = "zone255f4ea8",
                CreationTimestamp = "creation_timestamp235e59a1",
                Region            = "regionedb20d96",
                Network           = "networkd22ce091",
                Fingerprint       = "fingerprint009e6052",
                Subnetwork        = "subnetworkf55bf572",
                Description       = "description2cf9da67",
                NamedPorts        = { new NamedPort(), },
                SelfLink          = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <InstanceGroup>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            InstanceGroupsClient client = new InstanceGroupsClientImpl(mockGrpcClient.Object, null);
            InstanceGroup        responseCallSettings = await client.GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            InstanceGroup responseCancellationToken = await client.GetAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Пример #21
0
        /// <summary>
        /// Creates an instance group in the specified project using the parameters that are included in the request.
        /// Documentation https://developers.google.com/compute/beta/reference/instanceGroups/insert
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Compute service.</param>
        /// <param name="project">Project ID for this request.</param>
        /// <param name="zone">The name of the zone where you want to create the instance group.</param>
        /// <param name="body">A valid Compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Insert(ComputeService service, string project, string zone, InstanceGroup body, InstanceGroupsInsertOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (zone == null)
                {
                    throw new ArgumentNullException(zone);
                }

                // Building the initial request.
                var request = service.InstanceGroups.Insert(body, project, zone);

                // Applying optional parameters to the request.
                request = (InstanceGroupsResource.InsertRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request InstanceGroups.Insert failed.", ex);
            }
        }
 internal Instance(InstanceGroup parent, Guid id, string name)
 {
     Parent = parent;
     Id     = id;
     Name   = name;
 }
Пример #23
0
        public void Execute()
        {
            StageView     stage = MainForm.CurrentStage;
            InstanceGroup sel   = MainForm.CurrentStage.Selection;

            Vex.Rectangle bounds = sel.StrokeBounds;
            uint[]        ids    = sel.SelectedIds;
            offsets = new Vex.Point[ids.Length];

            InstanceManager im      = MainForm.CurrentInstanceManager;
            List <uint>     sortIds = new List <uint>(ids);

            im.SortIndexesByLocation(sortIds, chainType);

            Vex.Point target = Vex.Point.Empty;

            if (chainType == ChainType.DistributedHorizontal)
            {
                float firstWidth      = MainForm.CurrentInstanceManager[sortIds[0]].StrokeBounds.Width;
                float lastWidth       = MainForm.CurrentInstanceManager[sortIds[sortIds.Count - 1]].StrokeBounds.Width;
                float fillWidth       = bounds.Width - firstWidth - lastWidth;
                float remainingWidths = 0;
                for (int i = 1; i < sortIds.Count - 1; i++)
                {
                    DesignInstance di = MainForm.CurrentInstanceManager[sortIds[i]];
                    remainingWidths += di.StrokeBounds.Width;
                }

                float spacing = (fillWidth - remainingWidths) / (sortIds.Count - 1);
                float curLoc  = bounds.Left;

                for (int i = 0; i < sortIds.Count; i++)
                {
                    DesignInstance di     = MainForm.CurrentInstanceManager[sortIds[i]];
                    Vex.Point      offset = new Vex.Point(curLoc - di.StrokeBounds.Left, 0);

                    Vex.Matrix m = di.GetMatrix();
                    m.Translate(offset);
                    stage.SetDesignInstanceMatrix(di, m);

                    curLoc += spacing + di.StrokeBounds.Width;

                    int realIndex = Array.IndexOf(ids, sortIds[i]);
                    offsets[realIndex] = offset;
                }

                target = new Vex.Point(spacing, float.NaN);
            }
            else if (chainType == ChainType.DistributedVertical)
            {
                float firstHeight      = MainForm.CurrentInstanceManager[sortIds[0]].StrokeBounds.Height;
                float lastHeight       = MainForm.CurrentInstanceManager[sortIds[sortIds.Count - 1]].StrokeBounds.Height;
                float fillHeight       = bounds.Height - firstHeight - lastHeight;
                float remainingHeights = 0;
                for (int i = 1; i < sortIds.Count - 1; i++)
                {
                    DesignInstance di = MainForm.CurrentInstanceManager[sortIds[i]];
                    remainingHeights += di.StrokeBounds.Height;
                }

                float spacing = (fillHeight - remainingHeights) / (sortIds.Count - 1);
                float curLoc  = bounds.Top;

                for (int i = 0; i < sortIds.Count; i++)
                {
                    DesignInstance di     = MainForm.CurrentInstanceManager[sortIds[i]];
                    Vex.Point      offset = new Vex.Point(0, curLoc - di.StrokeBounds.Top);

                    Vex.Matrix m = di.GetMatrix();
                    m.Translate(offset);
                    stage.SetDesignInstanceMatrix(di, m);

                    curLoc += spacing + di.StrokeBounds.Height;

                    int realIndex = Array.IndexOf(ids, sortIds[i]);
                    offsets[realIndex] = offset;
                }
                target = new Vex.Point(float.NaN, spacing);
            }
            else
            {
                Vex.Rectangle contrainedBounds = bounds.Clone();
                stage.CurrentEditItem.BondStore.ConstrainBounds(sortIds, ref contrainedBounds, chainType);

                switch (chainType)
                {
                case ChainType.AlignedLeft:
                    target = new Vex.Point(contrainedBounds.Left, float.NaN);
                    break;

                case ChainType.AlignedCenterVertical:
                    target = new Vex.Point(contrainedBounds.Center.X, float.NaN);
                    break;

                case ChainType.AlignedRight:
                    target = new Vex.Point(contrainedBounds.Right, float.NaN);
                    break;

                case ChainType.AlignedTop:
                    target = new Vex.Point(float.NaN, contrainedBounds.Top);
                    break;

                case ChainType.AlignedCenterHorizontal:
                    target = new Vex.Point(float.NaN, contrainedBounds.Center.Y);
                    break;

                case ChainType.AlignedBottom:
                    target = new Vex.Point(float.NaN, contrainedBounds.Bottom);
                    break;
                }

                for (int i = 0; i < sortIds.Count; i++)
                {
                    DesignInstance di     = MainForm.CurrentInstanceManager[sortIds[i]];
                    Vex.Point      offset = Vex.Point.Zero;

                    switch (chainType)
                    {
                    case ChainType.AlignedLeft:
                        offset.X = target.X - di.StrokeBounds.Left;
                        break;

                    case ChainType.AlignedCenterVertical:
                        offset.X = target.X - (di.StrokeBounds.Left + di.StrokeBounds.Width / 2);
                        break;

                    case ChainType.AlignedRight:
                        offset.X = target.X - (di.StrokeBounds.Left + di.StrokeBounds.Width);
                        break;

                    case ChainType.AlignedTop:
                        offset.Y = target.Y - di.StrokeBounds.Top;
                        break;

                    case ChainType.AlignedCenterHorizontal:
                        offset.Y = target.Y - (di.StrokeBounds.Top + di.StrokeBounds.Height / 2);
                        break;

                    case ChainType.AlignedBottom:
                        offset.Y = target.Y - (di.StrokeBounds.Top + di.StrokeBounds.Height);
                        break;
                    }

                    Vex.Matrix m = di.GetMatrix();
                    m.Translate(offset);
                    stage.SetDesignInstanceMatrix(di, m);

                    offsets[i] = offset;
                }
            }

            if (useSmartBonds)
            {
                stage.CurrentEditItem.BondStore.Align(sortIds.ToArray(), chainType, target, addedBonds, previousBonds);
            }

            sel.Update();
            MainForm.CurrentStage.ResetTransformHandles();
            MainForm.CurrentStage.InvalidateTransformedSelection();
        }
Пример #24
0
        public void Execute()
        {
            StageView       stage   = MainForm.CurrentStage;
            InstanceGroup   sel     = stage.Selection;
            InstanceManager instMgr = stage.InstanceManager;

            prevSelection = sel.IdsByDepth;
            List <uint> addedInstances = new List <uint>();

            List <uint> newSelection   = new List <uint>();
            List <uint> toBreakApart   = new List <uint>();
            List <int>  originalDepths = new List <int>();

            for (int i = 0; i < prevSelection.Length; i++)
            {
                DesignInstance di = instMgr[prevSelection[i]];
                if (CanBreakApart(di))
                {
                    toBreakApart.Add(prevSelection[i]);
                    originalDepths.Add(di.Depth);
                }
                else
                {
                    newSelection.Add(prevSelection[i]);
                }
            }

            prevInstances = toBreakApart.ToArray();
            prevDepths    = originalDepths.ToArray();

            sel.Clear();
            for (int i = 0; i < toBreakApart.Count; i++)
            {
                uint           id        = toBreakApart[i];
                DesignInstance di        = instMgr[id];
                int            orgDepth  = di.Depth;
                Matrix         orgMatrix = di.GetSysMatrix();

                Vex.Point offset    = di.Location;
                uint[]    instances = ((DesignTimeline)di).InstanceIds;

                for (int j = instances.Length - 1; j >= 0; j--)
                {
                    DesignInstance orgInstance = instMgr[instances[j]];
                    uint           subLibId    = orgInstance.LibraryItem.DefinitionId;
                    DesignInstance inst        = stage.AddInstance(subLibId, Vex.Point.Zero);
                    stage.CurrentEditItem.ChangeDepth(inst.Depth, orgDepth);

                    using (Matrix m = orgInstance.GetSysMatrix().Clone())
                    {
                        m.Multiply(orgMatrix, MatrixOrder.Append);
                        stage.SetDesignInstanceMatrix(inst, m.VexMatrix());
                    }

                    addedInstances.Add(inst.InstanceHash);
                    newSelection.Add(inst.InstanceHash);
                }
                stage.RemoveInstancesById(new uint[] { id });
            }

            newInstances = addedInstances.ToArray();
            sel.Set(newSelection.ToArray());
            stage.ResetTransformHandles();
        }