Resolved. There was my mistake.

Resolved. There was my mistake.

klkl12234
Advocate Advocate
244 Views
2 Replies
Message 1 of 3

Resolved. There was my mistake.

klkl12234
Advocate
Advocate

Resolved. There was my mistake.

Hi, I want to change the value of the Mark parameter.
The other parameters changed the values in the same way
The value of this parameter has not been changed.

 

using (Transaction transaction = new Transaction(doc))
{

List<Element> ductElementList2 = new FilteredElementCollector(doc)
.OfClass(typeof(Duct))
.ToList<Element>();
foreach (Element duct in ductElementList2)
{

Autodesk.Revit.DB.Parameter setMark = newDuct.LookupParameter("Mark");

OR

Autodesk.Revit.DB.Parameter setMark = duct.get_Parameter(BuiltInParameter.ALL_MODEL_MARK);


bool flag = setMark.SetValueString("CBS"); //flag is false

OR

bool flag2 = setMark.Set("CBS"); //flag2 is true
doc.Regenerate();

 

 

 

if (setMark.IsReadOnly) { ////false
int a = 1;
}

}

}

0 Likes
Accepted solutions (1)
245 Views
2 Replies
Replies (2)
Message 2 of 3

klkl12234
Advocate
Advocate

Resolved. There was my mistake.

0 Likes
Message 3 of 3

architect.bim
Collaborator
Collaborator
Accepted solution

Hi!

There is no problem to change the "Mark" parameter with Set method. But SetValueString method "...only applies to parameters of value types". That's why it returns False and does not change the value. Use Set method instead!


Maxim Stepannikov | Architect, BIM Manager, Instructor
0 Likes