How to create image as parameter in a family

How to create image as parameter in a family

Anonymous
Not applicable
1,025 Views
1 Reply
Message 1 of 2

How to create image as parameter in a family

Anonymous
Not applicable

Hi everyone,

I am trying to add a new parameter to a family, in order to get that I do this 

 var familySymbol = (FamilySymbol)annotation.ToList()?.First();
            var famDoc = this._uiDocument.Document.EditFamily(family.Family);
            using (var trans = new Transaction(famDoc))
            {
                trans.Start("Adding parameter");
                var parameterType = ParameterType.Image; 
                famDoc.FamilyManager.AddParameter("Symbol image", BuiltInParameterGroup.INVALID, parameterType,
                    true);
                trans.Commit();
            }

But a error occurs,  "Instance parameter of image type is not allowed."

Can I add a image as a parameter using Revit Api?

0 Likes
Accepted solutions (1)
1,026 Views
1 Reply
Reply (1)
Message 2 of 2

RPTHOMAS108
Mentor
Mentor
Accepted solution

The message is telling you that parameter types of ParameterType.Image can only be used for Type parameters, this is the same as in the UI. Therefore:

 

.AddParameter("Image 1", BuiltInParameterGroup.INVALID, ParameterType.Image, False)

Will work.

.AddParameter("Image 1", BuiltInParameterGroup.INVALID, ParameterType.Image, True)

Will not work.

0 Likes