Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Couple of ViewSheet can't set couple custom parameters via API but can via the UI ...

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
EATREVITPOOPCAD
139 Views, 2 Replies

Couple of ViewSheet can't set couple custom parameters via API but can via the UI ...

So the custom parameters exist, are spelled correctly and etc... What is strange is that one of them I am able to set but the rest I can not via the API... Any ideas on why this is not working?

 

 

                           ViewSheet v = null;

                            v = ViewSheet.Create(doc, titleblockid);
                            v.Name = s.sheetTitle;
                            v.SheetNumber = s.sheetNumber;

                            Parameter p = null;

                            // DOES NOT WORK
                            p = v.LookupParameter("SHEET DISCIPLINE");          
                            if (!p.SetValueString("turkey"))
                                TaskDialog.Show("Error", "Failed to set discipline param");

                            // WORKS
                            p = v.LookupParameter("SHEET SORT CATEGORY");
                            if (!p.Set(123456))
                                TaskDialog.Show("Error", "Failed to set sort category param");

                            // DOES NOT WORK
                            p = v.LookupParameter("SHEET USE");
                            if (!p.SetValueString("Lamb"))
                                TaskDialog.Show("Error", "Failed to set use param");

                            // DOES NOT WORK
                            p = v.LookupParameter("SHEET SORT CODE");
                            if (!p.SetValueString("chicken"))
                                TaskDialog.Show("Error", "Failed to set sort code param");

 

 

EATREVITPOOPCAD_0-1674167148521.png

 

EATREVITPOOPCAD_3-1674167393062.png

 

 

EATREVITPOOPCAD_2-1674167371899.png

 

 

EATREVITPOOPCAD_4-1674167417640.png

 

The definition of insanity is doing the same thing over and over again and expecting different results
2 REPLIES 2
Message 2 of 3

SetValueString is for setting value types e.g. 5' - 10 1/4"

I would put the above imperial units in quote marks but that would just be confusing.

 

The one that works uses 'Set'.

Message 3 of 3

Ahh thank you!

The definition of insanity is doing the same thing over and over again and expecting different results

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Customer Advisory Groups


Rail Community