Get discipline of view

Hey

I want to filter all views by discipline, but when I use the element.getparameterValueByname node it gives me numbers instead of a discipline. What am I missing?

That’s how revit stores them.

1 Architecture
2 Structure
4 Mechanical
8 Electrical
4095 Coordination

btw: package “Bakery” has a node “Enumerate View Discipline” that gives you both the “Name” and “HashCode” of the viewdisciplines - might you want to use the ‘string value’ instead of hashcode,

1 Like

Ok then I assume 4095 is a code that enlists all views without a discipline.

I will install the Bakery package…I want to create a menu and be able to select the dicipline from a dropdown menu…numbers do not mean that much, bedankt voor je hulp :smile:

4095 is coordination.

The Bakery package was no succes…it actually doesn’t do a thing (probably a version thing).

I have the following Dynamo scheme and want to delete the top nodes though can’t seem to create a direct link with the list node (red line), so I temporarily use the top nodes to let the tool work.

The dropdown (in blue) is what I want to attach to the menu to be able to select the correct discipline to filter the views.

Rename Sheetnumber var 4.dyn (53.5 KB)

What must I do to filter the views with the selected discipline?:face_with_raised_eyebrow:
I’m a litle stuck with this puzzle so I would appreciate it if someone could help me.

Hi @kboschJGDNZ,

Would this work for you?

import clr

#Import the Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

views = UnwrapElement(IN[0])

output = []

for i in UnwrapElement(IN[0]):
	output.append(i.Discipline.ToString())

OUT = output

Bakery retrieves the names / hashcodes as defined by Revit.

So, you want to use inputform to select the ‘textual’ values and set them using the ‘hashcode’?

Clipboard01
Clipboard01

forum_view_discipline.dyn (5.9 KB)

Ah nice @3Pinter. Didn’t know of that :slight_smile:

That looks good. I want to filter all views by selecting the right discipline … the views that correspond to the selected discipline will then be checked whether its view name contains a certain key and can then be replaced with an other value. That’s a module that what I want to create.

I have the package, but still got an error.

image

Ah, I’m using a older version.

Did you see the notification while installing this package? Says something like “The package manager hates Bakery, bakery is tasty goodness”

Not all nodes are installed (eventhough you might get the feeling it does) …

So they suggest this method:

  • in dynamo go to ‘manage packages’
  • search for bakery
  • select “show root directory”
  • windows explorer starts,
  • go to subdirectory ‘extra’ …
    (packages\Bakery\extra)
  • you’ll see a ‘unzip_to_dyf_folder.zip’
  • do that
  • restart dynamo.

you are good to go.

Yeah that did the trick :+1: …the only thing that still did not happen was that the menu came up.

haha. Probably yet again, an older version I’m using. Let me check.

Just updated my current version to the latest build … no issues here.forum_view_discipline.dyn (6.0 KB)

After replacing the nodes by fresh ones…your module seems to work.
Strange but …doesn’t really matter …it works :rofl:

Awesome! Please mark a post as solution so it keeps the forum tidy