distribution list with API

distribution list with API

Erich.Kallenda
Explorer Explorer
413 Views
6 Replies
Message 1 of 7

distribution list with API

Erich.Kallenda
Explorer
Explorer
 

How can I use API to control whether names need to be updated in a distribution list? 

0 Likes
414 Views
6 Replies
Replies (6)
Message 2 of 7

jeremy_tammik
Alumni
Alumni

Is this list a BIM schedule? If so, doesn't it update automatically whenever the model changes? This is a BIM, and everything ought to be connected.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 7

Erich.Kallenda
Explorer
Explorer

This is a Parameter in the Panel Shedules, and changes you must make manually.

When in project are 50 panel shedules it ist many time you need to control.

0 Likes
Message 4 of 7

Erich.Kallenda
Explorer
Explorer

ErichKallenda_0-1737467524437.png

 

 

When you have changes, you mast go into the list, and take the button "Update Names"

0 Likes
Message 5 of 7

jeremy_tammik
Alumni
Alumni

Aha. Well, in that case, if it is so simple, this process can be easily automated as follows, with no programming and no API usage required, using a journal file:

 

Assuming you have a number N of files. You wish to open file 1, 2, 3, ... N, display the form that you show in your screen snapshot. click Update Names, close the form, save the file, close the file. 

 

In that case, automate it like this, more or less:

 

  • Launch Revit.exe
  • Open file 1
  • Display the form
  • Click Update Names
  • Close the form
  • Save the file
  • Close the file
  • Shut down Revit

 

Now go and find the journal file that was generated by that process.

 

You can use this journal file to perform the same actions in each of the other files.

 

Yes, you need to start Revit and shut it down every time for every file, so it is a slow process. Who cares, it is automatic.

 

Here are two examples of using this technique in practice (15 years ago!):

 

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 6 of 7

Vitaly_Demur
Explorer
Explorer

Hello Jeremy,

Thank you very much for your response and the direction we should look into.

 

I am Erich's colleague and have asked him to improve the program's weakness. In the Revit distribution lists, there is only one way to change the elements or the description of the circuit. The 'Circuit Description' is automatically generated from the parameters of the circuit [Load Classification] and [Space Name-Number].

 

When I move the element to another room, Revit does not update it automatically - you have to manually click into the cell first, and then the 'Update Name' button becomes available, which you can click. (Gelöst: Electrical Circuits - Update Names - Autodesk Community)

 

We want to achieve with the programming that the user is first shown the list of changed distributors (i.e., elements that have been moved to another room), and the user can then decide which distributor to update. Erich has started to create a logic and is first looking for this function in the API.

 

Could you please show us the direction again based on the new findings?

 

I have looked at the journal file and found the following commands.

 

Jrn.PushButton "ToolBar , {}{} , Dialog_BuildingSystems_PanelScheduleCircuitDlgbar" _
, "Update Names, Control_BuildingSystems_CircuitsUpdateNames"
' 0:< Unnecessary nesting;ACommandRouter_2;-1;ID_PANELSCHEDULE_CIRCUITS_UPDATENAMES ;N++EB(NB);

 

Thank you in advance!

Vitaly 

0 Likes
Message 7 of 7

rcrdzmmrmnn
Advocate
Advocate

I would also go the same way as the link you posted above. You don't need to automate clicking the "Update Names" if you can replicate it's function yourself. I think a pseudocode would look like this:

foreach circuit in circuits

     originalLoadName = circuit.LoadName

     potentialNewName = ""

     elementsFromCircuit = circuit.Elements

     foreach element in elementsFromCircuit

           elementSpaceName = element.Space.Name

           elementSpaceNumber = element.Space.Number

           potentialNewName+=$"{elementSpaceName} {elementSpaceNumber},"

     if(originalLoadName ==potentialNewName)

          print("no elements were moved")

     else

          #add circuit to a list of changed circuits to further analysis

I mean, there are nuances, like, if only one space is found, the Load Name will be [Load Type] [SpaceName] [Space Number], and if there is more than one, the name will be [Load Type] [SpaceNumber1] [Space Number2] [Space NumberX]
but I think it's way more convenient than to work with PostCommand and JournalFiles etc...