View Scale Name

I am trying to extract the view scale name of view, but everything I try just outputs the scale ratio instead. Is there a way to extract the view scale name? It looks like it is an option when I list out the element parameters.

1 Like

See here, maybe will help you out.

FYI: the parameter Vale as you show per the API is an integer.

Hi there Matthew,

This workflow worked for me. I opted for a different way of selecting all the views from the project. Your method of selection also worked.

Views that have no scale, such as perspective views don’t report anything but the script still works.

What I am trying to get is the view scale name (the scale display name), i.e. 6" = 1’-0", 1/8" = 1’-0"… not the scale ratio. You can see in my first post that the element.parameters node does list the view scale (6" = 1’-0") so it must be possible. However when you try to get that parameter information is just reports the scale ratio.

I have some custom scales with custom display names in a project and I want to be able to extract that information.

This is because the parameter in dynamo is giving you the “AsInteger” value not the “AsValueString”. There may be examples of how to get this from a parameter on the forum to help you, just do a search for “AsvalueString parameter”.

I have just looked at a view via the revit lookup and this is how the information is stored within revit.

1 Like

In addition to what Brendan said, copy/paste this into a python code node. This will work with a flat list of views.

import System
from System.Collections.Generic import *

import clr
clr.AddReference('RevitAPI') 
from Autodesk.Revit.DB import *


views						= UnwrapElement(IN[0])


out = []
for i in views:
    out.append(i.LookupParameter("View Scale").AsValueString())


 OUT = out
1 Like

Thank you both that solved the problem and the python scrip worked perfectly.

1 Like