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 !
Solved! Go to Solution.
Solved by jeremytammik. Go to Solution.
Solved by jeremytammik. Go to Solution.
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:
Cheers,
Jeremy
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 !
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
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!
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