change phase of a view

change phase of a view

Anonymous
Not applicable
1,664 Views
5 Replies
Message 1 of 6

change phase of a view

Anonymous
Not applicable

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 !

0 Likes
Accepted solutions (2)
1,665 Views
5 Replies
Replies (5)
Message 2 of 6

jeremytammik
Autodesk
Autodesk

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

Anonymous
Not applicable

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 !

0 Likes
Message 4 of 6

jeremytammik
Autodesk
Autodesk
Accepted solution

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

Anonymous
Not applicable

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!

0 Likes
Message 6 of 6

jeremytammik
Autodesk
Autodesk
Accepted solution

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