Results 1 to 3 of 3

Thread: Trouble changing built in parameter of view

  1. #1
    Member
    Join Date
    2016-06
    Posts
    5
    Login to Give a bone
    0

    Default Trouble changing built in parameter of view

    Good evening,

    I am trying to change the phase filter to Show All in a 3D view using the API. However it seems i can't set the parameter even when it return True.

    The value of the phase filter parameter remains the same after running the script.
    What am i doing wrong?
    If it's impossible to change the phase filter, is there a way to import a viewtemplate from another file and apply that to a 3Dview?

    Code:
    using System;
    using Autodesk.Revit.UI;
    using Autodesk.Revit.DB;
    using Autodesk.Revit.UI.Selection;
    using System.Collections.Generic;
    using System.Linq;
    
    namespace test
    {
        [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
        [Autodesk.Revit.DB.Macros.AddInId("0C4DCB69-0A65-4FE4-9269-63E62D661120")]
        public partial class ThisDocument
        {
            private void Module_Startup(object sender, EventArgs e)
            {
    
            }
    
            private void Module_Shutdown(object sender, EventArgs e)
            {
    
            }
    
            #region Revit Macros generated code
            private void InternalStartup()
            {
                this.Startup += new System.EventHandler(Module_Startup);
                this.Shutdown += new System.EventHandler(Module_Shutdown);
            }
            #endregion
            public void test12()
            {
                UIDocument uidoc = Application.ActiveUIDocument;
                Document doc = uidoc.Document;
                FilteredElementCollector collector = new FilteredElementCollector( doc ).OfClass( typeof( View3D ) );
                
                
                foreach( View3D v in collector )
                {
                    msg(v.Title.ToString());
                    Parameter param = v.get_Parameter(BuiltInParameter.VIEW_PHASE_FILTER);
                    msg(param.AsValueString());
                    msg(param.Set("Show All").ToString());
                    msg(param.AsValueString());
                }
    
            }
            
                        public void msg(string message)
                {
                    TaskDialog.Show("debug", message);
                
                }
        }
    }

  2. #2
    I could stop if I wanted to
    Join Date
    2007-07
    Location
    London, UK
    Posts
    361
    Login to Give a bone
    0

    Default Re: Trouble changing built in parameter of view

    VIEW_PHASE_FILTER parameter type is ElementId, not boolean.

    First, you have to find the "Show all" filter (using a collector, for instance), and then assign its Id property to the parameter.

  3. #3
    Member
    Join Date
    2016-06
    Posts
    5
    Login to Give a bone
    0

    Default Re: Trouble changing built in parameter of view

    Thank you! It worked perfectly!

Similar Threads

  1. Built In Parameter conversion Revit API
    By ConXCAD in forum Dot Net API
    Replies: 0
    Last Post: 2014-09-10, 03:56 PM
  2. 2014: Built-In Offset Parameter Versus Creating One
    By tonykart87372479 in forum Revit MEP - Families
    Replies: 1
    Last Post: 2013-04-19, 11:18 PM
  3. Replies: 2
    Last Post: 2010-06-30, 01:09 PM
  4. Trouble Changing a Level
    By jcoe in forum Revit Architecture - General
    Replies: 4
    Last Post: 2007-01-16, 09:08 PM
  5. Changing a project parameter in plan view versus project browser
    By Nic M. in forum Revit Architecture - General
    Replies: 0
    Last Post: 2004-10-29, 12:20 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •