Wall type function is "Exterior" with python


#1

Hi all,

I would like to get only exterior wall with a python script.

I did this (see below):

#Import librairies and Namespaces
import clr
import System
import math
clr.AddReference(‘ProtoGeometry’)
clr.AddReference(‘RevitAPI’)
clr.AddReference(‘RevitAPIUI’)

from Autodesk.DesignScript.Geometry import *

#Document and Transaction
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from Autodesk.Revit.DB import *

import Autodesk
from Autodesk.Revit.DB.LabelUtils import GetLabelFor
from Autodesk.Revit.DB.ParameterFilterRuleFactory import CreateEqualsRule
from Autodesk.Revit.DB.ElementId import *
#Define the inputdata

Walls = UnwrapElement(IN[0])

#Creating a variable doc which set the active Revit application and document

doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)
#Start the script

#Avoir les murs ayant une fonction du mur
ext=ElementId(BuiltInParameter.FUNCTION_PARAM)

Parameters=ParameterFilterRuleFactory.CreateEqualsRule(ext,(WallFunction.Exterior))

#End the script
TransactionManager.Instance.TransactionTaskDone()

OUT=Parameters

It doesn’t work , Dynamo said that : no module named ElementId

Thank you for your help :slight_smile:


#2

Is this what you are trying to achieve?


#3

This is an issue there has been dealt with before…


#4

I don’t want to use str because if my revit are not in english that kind of script doesn’t work.

That’s why, I’m using API.


#5

Yes :slight_smile:


#6

Please mark post as solved.


#7

To clarify, the link and python pointed out by @erfajo also works, regardless of language for anyone other than the initial coder, and has the added benefit of allowing selection of other walls by their type, so I’m putting forth this hybrid of both codes incase it helps someone else find walls of a given function in the future.