Example #1
0
 public static OverrideGraphicSettings GetTingledOverrideGraphicSettings(Document doc)
 {
     if (_TingledOverrideGraphicSettings == null)
     {
         _TingledOverrideGraphicSettings = Revit_Helper.GetOverrideGraphicSettings(new Autodesk.Revit.DB.Color(185, 185, 185), GetDefaultFillPatternId(doc), 80);
     }
     return(_TingledOverrideGraphicSettings);
 }
Example #2
0
        public void ApplySettingForDisplay(View view, List <ElementId> elementIds)
        {
            OverrideGraphicSettings setting = GetOverrideGraphicSettings(view.Document);

            foreach (var elementId in elementIds)
            {
                Revit_Helper.ApplyOverrideGraphicSettings(view, elementId, setting);
            }
        }
Example #3
0
        /// <summary>
        /// 解除对元素增加的节点的配置
        /// </summary>
        /// <param name="element"></param>
        void DeapplySetting(View view, ElementId elementId)
        {
            Revit_Helper.ApplyOverrideGraphicSettings(view, elementId, VLConstraints.DefaultCPSettings);

            //var group = view.Document.GetElement(elementId) as Group;
            //if (group != null)
            //{
            //    foreach (var memberId in group.GetMemberIds())
            //        view.SetElementOverrides(memberId, EarthworkBlockingConstraints.DefaultCPSettings);
            //}
            //else
            //{
            //    view.SetElementOverrides(elementId, EarthworkBlockingConstraints.DefaultCPSettings);
            //}
        }
Example #4
0
        OverrideGraphicSettings GetOverrideGraphicSettings(Document doc)
        {
            var setting = Revit_Helper.GetOverrideGraphicSettings(new Color(Color.R, Color.G, Color.B), FillerId == -1 ? GetDefaultFillPatternId(doc) : new ElementId(FillerId), SurfaceTransparency);

            setting.SetHalftone(IsHalftone);
            return(setting);

            //var setting = new OverrideGraphicSettings();
            //setting.SetHalftone(IsHalftone);
            //setting.SetProjectionFillPatternVisible(IsSurfaceVisible);
            //setting.SetProjectionFillColor(new Color(Color.R, Color.G, Color.B));
            //if (FillerId == -1)
            //    setting.SetProjectionFillPatternId(GetDefaultFillPatternId(doc));
            //else
            //    setting.SetProjectionFillPatternId(new ElementId(FillerId));
            //setting.SetSurfaceTransparency(SurfaceTransparency);
            //return setting;
        }
Example #5
0
        private bool DetailWithView(Document doc, string transactionName, string cpSettingsString, View3D view, ShowDialogType dialogType, Func <List <ElementId> > GetElementIds)
        {
            bool isSuccess;

            ListForm.ShowDialogType = dialogType;
            string viewName = dialogType.GetViewName();

            isSuccess = DealWithTransaction(viewName, doc, transactionName, () =>
            {
                view = Revit_Document_Helper.GetElementByNameAs <View3D>(UI_Doc.Document, viewName);
                if (view == null)
                {
                    view = Revit_Document_Helper.Create3DView(doc, viewName);
                }
                ////渲染_所有 隐藏
                //IList<Element> allElements = GetAllElements(doc);
                //List<ElementId> elementIdsToHid = new List<ElementId>();
                //foreach (var element in allElements)
                //    if (element.CanBeHidden(view) && element.Id != view.Id)
                //        elementIdsToHid.Add(element.Id);
                //if (elementIdsToHid.Count > 0)
                //    view.HideElements(elementIdsToHid);
                ////渲染_测点 淡显,显示
                //var allNodesElementIds = Model.GetAllNodesElementIds(doc);
                //var defaultOverrideGraphicSettings = CPSettings.GetTingledOverrideGraphicSettings(doc);
                //if (allNodesElementIds.Count > 0)
                //    view.UnhideElements(allNodesElementIds);
                //foreach (var elementId in allNodesElementIds)
                //    view.SetElementOverrides(elementId, defaultOverrideGraphicSettings);
                //渲染_选中 选中颜色显示
                var cpSettings = new CPSettings(cpSettingsString);
                var overrideGraphicSettings = Revit_Helper.GetOverrideGraphicSettings(new Color(cpSettings.Color.R, cpSettings.Color.G, cpSettings.Color.B), new ElementId(cpSettings.FillerId), cpSettings.SurfaceTransparency);
                var selectedElementIds      = GetElementIds();
                foreach (var elementId in selectedElementIds)
                {
                    view.SetElementOverrides(elementId, overrideGraphicSettings);
                }
            });
            if (view != null)
            {
                UI_Doc.ActiveView = view;
            }
            return(isSuccess);
        }
Example #6
0
        public void ApplySettingWithoutTransaction(TEarthworkBlocking blocking, List <ElementId> elementIds)
        {
            if (elementIds == null || elementIds.Count == 0)
            {
                return;
            }
            OverrideGraphicSettings setting = GetOverrideGraphicSettings(VLConstraints.Doc);

            //元素可见性
            if (IsVisible)
            {
                VLConstraints.View3D.UnhideElements(elementIds);
            }
            else
            {
                VLConstraints.View3D.HideElements(elementIds);
            }
            //元素表面填充物配置
            foreach (var elementId in elementIds)
            {
                Revit_Helper.ApplyOverrideGraphicSettings(VLConstraints.View3D, elementId, setting);
            }
        }
Example #7
0
        /// <summary>
        /// 视图逻辑处理
        /// 支持(隐藏,淡显,红显)和(反隐藏,淡显,红显)
        /// </summary>
        /// <param name="showDialogType"></param>
        /// <param name="needHide"></param>
        /// <param name="getElementIds"></param>
        /// <returns></returns>
        private bool DetailWithView(ShowDialogType showDialogType, bool needHide, Func <Document, List <ElementId> > getElementIds)
        {
            ListForm.ShowDialogType = showDialogType;
            string viewName        = ListForm.ShowDialogType.GetViewName();
            var    doc             = UI_Doc.Document;
            View3D view            = null;
            var    transactionName = nameof(SubsidenceMonitor) + nameof(btn_ViewSelection_Click);
            bool   isSuccess       = DealWithTransaction(viewName, doc, transactionName, () =>
            {
                view = Revit_Document_Helper.GetElementByNameAs <View3D>(UI_Doc.Document, viewName);
                if (view == null)
                {
                    view = Revit_Document_Helper.Create3DView(doc, viewName);
                }
                if (needHide)
                {
                    //渲染_所有 隐藏
                    IList <Element> allElements      = GetAllElements(doc);
                    List <ElementId> elementIdsToHid = new List <ElementId>();
                    foreach (var element in allElements)
                    {
                        if (element.CanBeHidden(view) && element.Id != view.Id)
                        {
                            elementIdsToHid.Add(element.Id);
                        }
                    }
                    if (elementIdsToHid.Count > 0)
                    {
                        view.HideElements(elementIdsToHid);
                    }
                    //渲染_测点 淡显
                    var nodesElementIds = Model.GetAllNodesElementIdsByTNode(doc);
                    if (nodesElementIds.Count > 0)
                    {
                        view.UnhideElements(nodesElementIds);
                    }
                    var defaultOverrideGraphicSettings = CPSettings.GetTingledOverrideGraphicSettings(doc);
                    foreach (var elementId in nodesElementIds)
                    {
                        view.SetElementOverrides(elementId, defaultOverrideGraphicSettings);
                    }
                }
                else
                {
                    ////渲染_所有 反隐藏
                    //IList<Element> allElements = GetAllElements(doc);
                    //List<ElementId> elementIdsToHid = new List<ElementId>();
                    //foreach (var element in allElements)
                    //    if (element.CanBeHidden(view) && element.Id != view.Id)
                    //        elementIdsToHid.Add(element.Id);
                    //view.UnhideElements(elementIdsToHid);
                    //渲染_所有 淡显
                    var allElementIds = GetAllElements(doc);
                    var defaultOverrideGraphicSettings = CPSettings.GetTingledOverrideGraphicSettings(doc);
                    foreach (var elementId in allElementIds)
                    {
                        view.SetElementOverrides(elementId.Id, defaultOverrideGraphicSettings);
                    }
                }
                //渲染_选中 红显
                var overrideGraphicSettings = Revit_Helper.GetOverrideGraphicSettings(ColorForSelectedElements, CPSettings.GetDefaultFillPatternId(doc), 0);
                var selectedElementIds      = getElementIds(doc);
                foreach (var elementId in selectedElementIds)
                {
                    view.SetElementOverrides(elementId, overrideGraphicSettings);
                }
            });

            if (view != null)
            {
                UI_Doc.ActiveView = view;
            }
            return(isSuccess);
        }
Example #8
0
        /// <summary>
        /// 对元素增加节点的配置
        /// </summary>
        /// <param name="element"></param>
        //void ApplySetting(View view, ElementId elementId, OverrideGraphicSettings setting)
        //{
        //    var group = view.Document.GetElement(elementId) as Group;
        //    if (group != null)
        //    {
        //        foreach (var memberId in group.GetMemberIds())
        //            view.SetElementOverrides(memberId, setting);
        //    }
        //    else
        //    {
        //        view.SetElementOverrides(elementId, setting);
        //    }
        //}
        void ApplySetting(View view, ElementId elementId)
        {
            OverrideGraphicSettings setting = GetOverrideGraphicSettings(view.Document);

            Revit_Helper.ApplyOverrideGraphicSettings(view, elementId, setting);
        }