I would like to change the walltype name of a wall through API, but it seems it does not work right. It seems the members in WallType cannot be modified, even public ones.
foreach (Element collectedElem in collection) {
if (collectedElem.GetType().Name == "Wall") {
Wall wall = (Wall)collectedElem;
string wallValue=collectedElem.Level.Name+";"+collectedElem.Name;
TaskDialog.Show("Wallvalue", wallValue);
if (walltype.Contains(wallValue) == false)
{
walltype.Add(wallValue);
}
else {
wall.WallType.Name="NewName";
TaskDialog.Show("change value", wall.WallType.Name );
}
}
}
TaskDialog.Show("Test", "End of searching document!");
}
Dear jeffreybo.liu,
There is no reason why you cannot programmatically modify the name of a wall type.
However, your code below mixes together a number of different steps in one place.
I would suggest that you do one thing at a time, e.g.
I hope this helps.
Best regards,
Jeremy
Thank you very much!:-)
I did not open a transaction before I made the change on the revit document. Revit threw it into an exception. I was too noooobie... Working harder~~
I am glad it helped.
Please look at the getting started material before doing anything else:
http://thebuildingcoder.typepad.com/blog/about-the-author.html#2
Especially, work through the My first plugin and DevTV tutorials.
That will give you the hang of things.
Cheers,
Jeremy