# Phases - weirdness

**URL:** <https://forum.dynamobim.com/t/phases-weirdness/84659>\
**Category:** Revit\
**Created:** [January 5, 2023, 9:57am UTC](https://forum.dynamobim.com/t/phases-weirdness/84659 "2023-01-05T09:57:04Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alien](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alien/32/40701_2.png) [@Alien](https://forum.dynamobim.com/u/Alien)\
**Post date:** [January 5, 2023, 9:57am UTC](https://forum.dynamobim.com/t/phases-weirdness/84659/1 "2023-01-05T09:57:04Z")

</div>

Anyone know why this happens? Why does it behave differently with the Proposed phase?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/f/af87583a6e27ae092e606f7272ad17751db0d8f9.png)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/b/6b152ce0fee5ece95fba4ce994ce69bf75e0e00e.png)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/9/99f4fbeef9883bdfd516ecbb0e8181e28e08f08f.png)

---

<div class="post-metadata">

**Author:** ![manonio](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/manonio/32/137419_2.png) [@manonio](https://forum.dynamobim.com/u/manonio)\
**Post date:** [January 5, 2023, 10:30am UTC](https://forum.dynamobim.com/t/phases-weirdness/84659/2 "2023-01-05T10:30:43Z")

</div>

Hey, The only thing I can think of is that when creating the fases this one was combined with another.(so its basicly two fases) Probably if you create a new fase with this name it might work.

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [January 5, 2023, 11:31am UTC](https://forum.dynamobim.com/t/phases-weirdness/84659/3 "2023-01-05T11:31:51Z")

</div>

Heya,

I agree that this is odd behaviour…

I think this is likely to be because when pulling parameter values ‘by name’ there can be duplication in the names.

> <https://github.com/DynamoDS/DynamoRevit/blob/master/src/Libraries/RevitNodes/Elements/Element.cs>

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/a/3afc451f81c8dca09d1f9d17fc78031813554342.png)

I would try and pull the Phase by ‘built in parameter’ I think there is a node in [Archi-Lab](https://forum.dynamobim.com/t/revit-2022-dynamo-2-10-package-not-showing-up-and-icons-missing/62933/7?)… This is more robust.

I hope that helps,

Mark

---

<div class="post-metadata">

**Author:** ![Alien](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alien/32/40701_2.png) [@Alien](https://forum.dynamobim.com/u/Alien)\
**Post date:** [January 5, 2023, 11:36am UTC](https://forum.dynamobim.com/t/phases-weirdness/84659/4 "2023-01-05T11:36:25Z")

</div>

Thanks 🙂 I wrote some Python that seems to have fixed it but I was wondering if this is normal/ why it does it etc.

It’s our company template so it’s on a lot of jobs so not easy to fix it if it is two phases that have merged.

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [January 5, 2023, 11:40am UTC](https://forum.dynamobim.com/t/phases-weirdness/84659/5 "2023-01-05T11:40:08Z")

</div>

I tried it with a test phase, which I then merged with another phase, but I couldn’t replicate your results… Maybe dig around in the project parameters and see if there is another ‘Phase’ parameter assigned to your Views? Unlikely but could happen 🙂

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/3/23e783713a871cf022e3b72ea817206da46bde5c.png)

---

<div class="post-metadata">

**Author:** ![Alien](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alien/32/40701_2.png) [@Alien](https://forum.dynamobim.com/u/Alien)\
**Post date:** [January 5, 2023, 11:43am UTC](https://forum.dynamobim.com/t/phases-weirdness/84659/6 "2023-01-05T11:43:52Z")

</div>

Our BIM manager has just told me the only phase he made was the standards.  
The Existing and Proposed were the Autodesk OOTB ones.

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [January 5, 2023, 11:50am UTC](https://forum.dynamobim.com/t/phases-weirdness/84659/7 "2023-01-05T11:50:53Z")

</div>

Perhaps strip the file out and upload it here for us to look at?

---

<div class="post-metadata">

**Author:** ![Alien](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alien/32/40701_2.png) [@Alien](https://forum.dynamobim.com/u/Alien)\
**Post date:** [January 5, 2023, 1:05pm UTC](https://forum.dynamobim.com/t/phases-weirdness/84659/8 "2023-01-05T13:05:36Z")

</div>

[Strippedcentral\_detached.rvt](https://forum.dynamobim.com/uploads/short-url/jHCD3EVVXezsK9SBqNrQP33ooNa.rvt) (2.4 MB)  
[Phases.dyn](https://forum.dynamobim.com/uploads/short-url/5a37EeB0RlvBuAjljBf3nhs4L2G.dyn) (7.4 KB)

Stripped model  
Dynamo as pictured 🙂

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [January 5, 2023, 3:14pm UTC](https://forum.dynamobim.com/t/phases-weirdness/84659/9 "2023-01-05T15:14:20Z")

</div>

Hey,

Hope this helps…

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/5/9503f33d72ebe45f4dee50ab94a1e7fb9edf9903.png)

> **[BuiltInParameter Enumeration](https://www.revitapidocs.com/2016/fb011c91-be7e-f737-28c7-3f1e1917a0e0.htm)**
>
> Online Documentation for Autodesk's Revit API: 2015, 2016, 2017, 2017.1, 2018

Cheers,

Mark

```auto
#Copyright(c) 2015, Konrad K Sobon
# @arch_laboratory, http://archi-lab.net

import clr
import sys
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# Import Element wrapper extension methods
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
import System

view = UnwrapElement(IN[0])
paramName = IN[1]

builtInParams = System.Enum.GetValues(BuiltInParameter)
for i in builtInParams:
    if i.ToString() == paramName:
			bip = i	

id = view.get_Parameter(bip).AsElementId()

OUT = doc.GetElement(id)

```

You will note that this python is written to work with View Phases, other parameter values may not return an ID, which is why the archilab code accounts for various storage types:

[https://github.com/ksobon/archilab/blob/master/archilabSharedProject/Revit/Elements/Parameter.c](https://github.com/ksobon/archilab/blob/master/archilabSharedProject/Revit/Elements/Parameter.c)

---

<div class="post-metadata">

**Author:** ![Alien](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alien/32/40701_2.png) [@Alien](https://forum.dynamobim.com/u/Alien)\
**Post date:** [January 5, 2023, 8:59pm UTC](https://forum.dynamobim.com/t/phases-weirdness/84659/10 "2023-01-05T20:59:27Z")

</div>

Thanks for that.

I’d already written some Python to solve my issue ([Phases - weirdness - #4 by Alien](https://forum.dynamobim.com/t/phases-weirdness/84659/4))…

**But I wanted to know _why_ it’s doing what it’s doing.**

This is what I wrote btw:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/0/e09e5eccd1a42f188013743824eb59c112dae68c.png)

I only need the name OR the Id (as long as I got the same output for each phase) so I went with the easy option. 🙂

---

<div class="post-metadata">

**Author:** ![Alien](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alien/32/40701_2.png) [@Alien](https://forum.dynamobim.com/u/Alien)\
**Post date:** [January 5, 2023, 9:07pm UTC](https://forum.dynamobim.com/t/phases-weirdness/84659/11 "2023-01-05T21:07:02Z")

</div>

I’ve just added the ID thanks to your code (I couldn’t find the bit in the Revit API for Id before)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/6/763d744d2b432e7632671af7184ec293ff98df40.png)

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/6/e6684a92f463899cc931fbbc72a28c779b40fe61.png)

😀

---

<div class="post-metadata">

**Author:** ![Alien](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alien/32/40701_2.png) [@Alien](https://forum.dynamobim.com/u/Alien)\
**Post date:** [January 5, 2023, 9:08pm UTC](https://forum.dynamobim.com/t/phases-weirdness/84659/12 "2023-01-05T21:08:36Z")

</div>

Same question remains though -

WHY does it behave that way with the Dynamo nodes? 😕

---

<div class="post-metadata">

**Author:** ![aaronrumple](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/aaronrumple/32/195292_2.png) [@aaronrumple](https://forum.dynamobim.com/u/aaronrumple)\
**Post date:** [January 6, 2023, 3:40pm UTC](https://forum.dynamobim.com/t/phases-weirdness/84659/13 "2023-01-06T15:40:46Z")

</div>

The why is pretty clear. The how is another issue. The Value out of the Element.GetParameterValueByName returns a var. So, a parameter might be a string, an integer, etc. Two of your phases are being returned as a phase element. (Revit.Elements.nknownElement) The phase in question is being returned as a String.

Honestly, I would have expected all of the Phase parameter to be returned AsValueString since you are starting with the view element, rather than a phase element. Typically, you would specify AsDouble, AsInteger, AsString, AsValueString or such. So, I think there is a bug in the node that isn’t parsing the value to the correct type. Returning an element from a parameter value would be a non-typical thing to return - unless the node were to look at the Storage Type. Or rather with the current release of Revit,the ForgeTypeId.

I think the question is how the node is parsing the input to determine the correct var output type. In this case it is unpredictable - at least in this file. I haven’t been able to replicate the issue in other files with Revit 2023.

---

<div class="post-metadata">

**Author:** ![Alien](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alien/32/40701_2.png) [@Alien](https://forum.dynamobim.com/u/Alien)\
**Post date:** [January 6, 2023, 4:06pm UTC](https://forum.dynamobim.com/t/phases-weirdness/84659/14 "2023-01-06T16:06:54Z")

</div>

I think you’re answering why the last node doesn’t work when it’s fed a string.  
That, as you say, is pretty clear.

I want to know why the, ‘Element.GetParameterValueByName’ node sometimes spits out a string.  
That’s what I’m asking. It is a very odd glitch!

---

<div class="post-metadata">

**Author:** ![aaronrumple](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/aaronrumple/32/195292_2.png) [@aaronrumple](https://forum.dynamobim.com/u/aaronrumple)\
**Post date:** [January 6, 2023, 4:23pm UTC](https://forum.dynamobim.com/t/phases-weirdness/84659/15 "2023-01-06T16:23:33Z")

</div>

Without seeing the code behind the node - hard to say. Revit has a lot of elements and parameters. I’m guessing this node is written to parse standard user defined parameters that fall into easily determined type categories. The node probably needs an input so you can manually force the correct data output rather than var. With var - you are at the mercy of the node’s code.

You’re on a version of Revit as ForgeTypeId was becoming a thing. This is one of those programmatic things that ForgeTypeId is trying to clear up.

how long has this file been around? It could be that this element is from a very old version of Revit and something is not quite right under the hood. This Phase has an element Id of 0. I think that is unusual. If I get rid of this phase (merge with previous) and replace it with a new one - the problem goes away. And I haven’t been able to recreate the issue with other files in Revit 2023. So, something about that particular phase and the node are not playing well together.

---

<div class="post-metadata">

**Author:** ![Alien](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alien/32/40701_2.png) [@Alien](https://forum.dynamobim.com/u/Alien)\
**Post date:** [January 6, 2023, 4:39pm UTC](https://forum.dynamobim.com/t/phases-weirdness/84659/16 "2023-01-06T16:39:12Z")

</div>

Good point about how long it’s been round. Our BIM manager tells me it’s inherited from previous BIM manager but updated. So in theory it could be over 7 years old… but upgraded several times.

I wonder if there’s a fix for that.

---

<div class="post-metadata">

**Author:** ![aaronrumple](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/aaronrumple/32/195292_2.png) [@aaronrumple](https://forum.dynamobim.com/u/aaronrumple)\
**Post date:** [January 6, 2023, 4:40pm UTC](https://forum.dynamobim.com/t/phases-weirdness/84659/17 "2023-01-06T16:40:22Z")

</div>

I did an audit, but that had no effect.

---

<div class="post-metadata">

**Author:** ![AmybeckenhamM8V47](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@AmybeckenhamM8V47](https://forum.dynamobim.com/u/AmybeckenhamM8V47)\
**Post date:** [January 26, 2023, 11:49am UTC](https://forum.dynamobim.com/t/phases-weirdness/84659/18 "2023-01-26T11:49:55Z")

</div>

Hello, i had a similar issue but relating to the Element.getparametervaluebyname.  
Instead i was shown to parameter.getparametervaluebyname which worked wonders!

> [@Copying Phased Demolished Value into a new parameter field](https://forum.dynamobim.com/t/copying-phased-demolished-value-into-a-new-parameter-field/85227/13):
>
> thank you!!! that worked perfectly!!!

> [@(Rooms) Phase and Phase Id](https://forum.dynamobim.com/t/rooms-phase-and-phase-id/50894/8):
>
> Ok, a colleague of mine (Thank you Andrew) found actually the answer and solution: For whatever reason the Element Id of Phase 4 is “0” as this little test demonstrates: [MicrosoftTeams-image] We thought we could fix it by adding a new phase ‘after’ Phase 4 and then merging it. We thought that would give it a new ID, but for whatever reason that didn’t work. Maybe I merged them the wrong way around? I merged the new Phase with Phase 4. I should probably have merged Phase 4 with the new one. H…

Hope that helps 🙂

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [January 26, 2023, 4:28pm UTC](https://forum.dynamobim.com/t/phases-weirdness/84659/19 "2023-01-26T16:28:19Z")

</div>

> [@Alien](#):
>
> WHY does it behave that way with the Dynamo nodes?

The short answer is it’s a bug. It’s not supposed to behave that way. The real question, which I don’t remember if it was ever determined or not, is whether this is an issue on the Dynamo side or the Revit side.

Either way, it doesn’t really matter. In this version, the node is not consistent when returning Phases. In subsequent versions the issue (as far as I’m aware) has been fixed. As you’ve shown, the API is always an option so there are still “workarounds”.
