Override pop-up window while in a loop

Override pop-up window while in a loop

Khadourwaseem
Enthusiast Enthusiast
704 Views
2 Replies
Message 1 of 3

Override pop-up window while in a loop

Khadourwaseem
Enthusiast
Enthusiast

I have a loop for changing parameters, and when it comes to some elements which show this pop-up message it just skips these elements

private void SetNum(Document doc, int num, List<Element> elements)
        {
            using (Transaction tr = new Transaction(doc, "Задание номера позиции элементам"))
            {
                tr.Start();
                
                foreach (Element curElement in elements)
                {
                    try
                    {
                        curElement.get_Parameter(new Guid("AE8FF999-1F22-4ED7-AD33-61503D85F0F4")).Set(num.ToString());
                    }
                    catch
                    {
                        
                        continue;
                    }

                    //curElement.LookupParameter("ADSK_Позиция").Set(num.ToString()); // Заполнение параметра Комментарии
                     // Заполнение общего параметра ADSK_Позиция
                }
                tr.Commit();
            }
        }

ts, Is there a way to just click ok if this window ever shows up? 

Снимок экрана 2021-12-13 170501.png

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

ricaun
Advisor
Advisor
Accepted solution

That's strange, looks like your shared parameter is set by type.

 

If that's the case, you have some options.

 

  • You could change by Instance, this gonna remove the popup.
  • You could instead of Setting the parameter on the Element you find the Type of this element and then set the parameter on the type, this gonna remove the popup probably.

I hope this helps.

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

0 Likes
Message 3 of 3

Khadourwaseem
Enthusiast
Enthusiast

It's not the answer I was looking for, but nonetheless, it solved my problem. and for that, I'm grateful.

0 Likes