Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

change phase of a view

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
sabatierae
1278 Views, 5 Replies

change phase of a view

Is it possible to change the phase of a view? Something like view.phase ? I've tried with the created pohase but it doesn't work..

Thank for your help !

5 REPLIES 5
Message 2 of 6
jeremytammik
in reply to: sabatierae

Does this old post help?

 

http://thebuildingcoder.typepad.com/blog/2009/03/create-room-on-level-in-phase.html

 

Please look specifically at the reply to most recent comment by Jared:

 

http://thebuildingcoder.typepad.com/blog/2009/03/create-room-on-level-in-phase.html#comment-6a00e553...

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 6
sabatierae
in reply to: jeremytammik

Hi Jeremy

I've tried what you explain on the blog but I don't know why it doesn't work..

 

 

       

  View active = commandData.Application.ActiveUIDocument.ActiveGraphicalView;
foreach (Phase ii in phase)
{
Parameter p = active.get_Parameter(BuiltInParameter.VIEW_PHASE);
                            ElementId iiId = ii.Id;
                            p.SetValueString(iiId);
}

 Thank for your help !

Message 4 of 6
jeremytammik
in reply to: sabatierae

Dear Sabatierae,

 

How is your variable 'phase' defined?

 

Have you checked what storage type the built-in parameter VIEW_PHASE is expecting?

 

You can use RevitLookup to explore it.

 

Whatever storage type it it expecting, I am pretty sure that you cannot set it using SetValueString.

 

I would expect the storage type to be ElementId, in which case you need to set it using the element id directly, e.g. like this:

 

p.Set(iiId);

 

I hope this helps.

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 6
sabatierae
in reply to: jeremytammik

Yeah it works !!

 

phase is defined : PhaseArray phase = doc.Phases;

 

Here is the code :

 

ElementId iiId = ii.Id;
Parameter p = active.get_Parameter(BuiltInParameter.VIEW_PHASE);
p.Set(iiId);

 with :

ii a Phase

active a view

 

Thank a lot!

Message 6 of 6
jeremytammik
in reply to: sabatierae

Dear Sabatierae,

 

Thank you for the confirmation!

 

I went ahead and promoted this to a proper blog post on its own to ensure it is easily found by others as well:

 

http://thebuildingcoder.typepad.com/blog/2014/08/setting-the-phase-of-a-view.html

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community