Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="bcfView"></param>
        private void IsolateElement(View3D bcfView)
        {
            var selectedComponent = ViewModel.SelectedComponent;

            if (null == selectedComponent)
            {
                return;
            }

            using (var trans = new Transaction(ActiveDoc))
            {
                trans.Start("Isolate View");
                try
                {
                    bcfView.IsolateElementTemporary(ViewModel.SelectedComponent.ElementId);

                    var element = ViewModel.SelectedComponent.RvtElement;
                    if (element != null)
                    {
                        var boundingBox = element.get_BoundingBox(null);
                        if (boundingBox != null)
                        {
                            BCFUIView.ZoomAndCenterRectangle(boundingBox.Min, boundingBox.Max);
                            BCFUIView.Zoom(0.8);
                        }
                    }
                    trans.Commit();
                }
                catch (Exception)
                {
                    trans.RollBack();
                }
            }
        }