My current script will receive a list of strings and when a string value is equal to IN[2]
(or IN[3]
) then the value will be replaced with "NULL"
. And yet if I define a variable with the desired value ( Weld1 = "307623"
) with the same value that I define in a code block. It does not work. And no error message either. I am completely stumped on this one. It was my understanding that if I define Weld1 = IN[1]
, which IN[1]
is wired to a code block with the contents of "307623"
, then that would be the same as if I define
Weld1 = "307623"
Here is my code below. The IN[0] is a list of strings that all portray the Type Id value of items in revit.
import clr
clr.AddReference('RevitAPI')
clr.AddReference("ProtoGeometry")
clr.AddReference("RevitNodes")
clr.AddReference("RevitServices")
clr.AddReference('RevitAPIUI')
import Autodesk
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
import RevitServices
from Autodesk.Revit.DB import *
from Autodesk.DesignScript.Geometry import *
from RevitServices.Persistence import *
from RevitServices.Transactions import *
clr.AddReference('DSCoreNodes')
import DSCore as DS
from DSCore import *
#import sys #clr.ImportExtensions(Revit.Elements) #from Revit.Elements import * #clr.ImportExtensions(Revit.GeometryConversion) #from Revit.GeometryConversion import * #clr.ImportExtensions(Revit.GeometryReferences) #from Revit.GeometryReferences import * #import System #from System.Collections.Generic import * #from System import *
####### Trying to remove the specified values from IN[0] list
######Step 1: Get all indices of values present in current list
#####Step 2: Remove Items at said Indices
lost=IN[0] #List of parameter values to
#list = lost
#ShortList=IN[1] #list of string values
str1=("307623") #value to remove from list
#Weld1 = str1
str2=("308609") #value to remove from list
#Weld2 = str2
#strs = str1.Append(str2)
cnt=len(lost)
inx=0
num1 = []
num2 = []
indices=[]
Output = 0
x = 0
#Weld1 = IN[2]
Weld2 = IN[3]
Weld1 = "Type Id : 307623";
#Weld2 = "308609"
rep = IN[1]
elementlist = list()
for item in lost:
if item is Weld1:
item = rep
elif item is Weld2:
item = rep
elementlist.append(item)
#str3i = str1i + str2i
#output = List.RemoveItemAtIndex(list, indices);
#NewID = [A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z];
#if NewID==(0):
# List.RemoveItem
#List.RemoveIfNot(NewID, (>=0));
OUT = elementlist
I apologize for all the comments in my code.