Exemplo n.º 1
0
        /// <summary>
        ///  Set PartsVisibility of view
        /// </summary>
        /// <param name="partsVisibility"></param>
        /// <returns></returns>
        public View SetPartsVisibility(string partsVisibility)
        {
            PartsVisibility parts;

            parts = (PartsVisibility)Enum.Parse(typeof(PartsVisibility), partsVisibility);

            RevitServices.Transactions.TransactionManager.Instance.EnsureInTransaction(Application.Document.Current.InternalDocument);
            var param = InternalView.get_Parameter(BuiltInParameter.VIEW_PARTS_VISIBILITY);

            param.Set((int)parts);
            RevitServices.Transactions.TransactionManager.Instance.TransactionTaskDone();

            return(this);
        }
Exemplo n.º 2
0
        /// <summary>
        ///  Set Discipline of View.
        /// </summary>
        /// <param name="discipline"></param>
        /// <returns></returns>
        public View SetDiscipline(string discipline)
        {
            ViewDiscipline viewDiscipline;

            viewDiscipline = (ViewDiscipline)Enum.Parse(typeof(ViewDiscipline), discipline);

            RevitServices.Transactions.TransactionManager.Instance.EnsureInTransaction(Application.Document.Current.InternalDocument);
            if (InternalView.CanModifyViewDiscipline())
            {
                var param = InternalView.get_Parameter(BuiltInParameter.VIEW_DISCIPLINE);
                param.Set((int)viewDiscipline);
            }
            else
            {
                throw new Exception(String.Format(Properties.Resources.CantModifyInView, "ViewDiscipline"));
            }

            RevitServices.Transactions.TransactionManager.Instance.TransactionTaskDone();

            return(this);
        }