CreateAddInCommandBinding for Duct/Pipe Sizing command

CreateAddInCommandBinding for Duct/Pipe Sizing command

AnatolyCEL
Enthusiast Enthusiast
1,382 Views
11 Replies
Message 1 of 12

CreateAddInCommandBinding for Duct/Pipe Sizing command

AnatolyCEL
Enthusiast
Enthusiast

Hello,

 

I need to create AddInCommandBinding for Duct/Pipe Sizing button, which appeared in "Modify" panel when a pipe or duct is selected. What RevitCommandId should I use?

 

Thanks,

Anatoly.

0 Likes
1,383 Views
11 Replies
Replies (11)
Message 2 of 12

rosalesduquej
Alumni
Alumni

Hello,

 

You can get and set the duct diameter, width and height via these parameters:

 

Diameter:RBS_CURVE_DIAMETER_PARAM

Width: RBS_CURVE_WIDTH_PARAM

Height: RBS_CURVE_HEIGHT_PARAM

 

For example, you want to increase the width of your rectangle duct by 100mm. Here is the code fragment.

 

 

Parameter param = duct.get_Parameter(BuiltInParameter.RBS_CURVE_WIDTH_PARAM);
            
double width = param.AsDouble();
param.Set(width + 100);

 

You can always create new ones also, using NewDuct and NewPipe method.

 

Hope it helps, Cheers,



Jaime Rosales D.
Sr. Developer Consultant
Twitter | AEC ADN DevBlog
0 Likes
Message 3 of 12

AnatolyCEL
Enthusiast
Enthusiast

Thanks, but I have to make some actions (set parameters) when user click Duct/Pipe Sizing button. So, I need to use "AddInCommandBinding.BeforeExecuted" Event. I can do "CreateAddInCommandBinding(RevitCommandId revitCommandId)".

What RevitCommandId should I use? I tried to find this Id in Revit session journal, but it was not managed.

 

Thanks,

Anatoly.

0 Likes
Message 4 of 12

rosalesduquej
Alumni
Alumni

OK, give me some time to investigate about it, at the moment I dont have an immidiate answer. 

 

 

Thanks,



Jaime Rosales D.
Sr. Developer Consultant
Twitter | AEC ADN DevBlog
0 Likes
Message 5 of 12

rosalesduquej
Alumni
Alumni

Hi Anatoly,

 

I'm still doing research on this and also I have asked our Revit API Engineers to shed some light on where to find this RevitCommandId, if there is any. 

I will let you know as soon as I hear back from them. Thank you for your patience. 

 

Cheers,



Jaime Rosales D.
Sr. Developer Consultant
Twitter | AEC ADN DevBlog
0 Likes
Message 6 of 12

rosalesduquej
Alumni
Alumni

Hi,

 

Ok so following the steps to LookCommandId listed here https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2015/ENU/Revit-API/files/GUID-...

 

I open Revit to create the Journals and the difference between each other is the resize of the width of one of the Ducts in my model. At first looking up for the Jrn.Command I did not see any difference. But then after I notice Jrn.ComboBox which goes trough the varios steps to change the size. 

 

Jrn.ComboBox "ToolBar , {}{} , Dialog_BuildingSystems_RbsDuctSizeBar" _ ,

"Control_BuildingSystems_RbsCbHeight" _ ,

"SelEndOk" , "400"

 

but remember posting a command will just post the standard UI command so the user will still see the UI, and will be forced to interact with it, for instance if an element needs to be selected, or a value such as 400 input.
 
As far as I know, there is no way to automate that kind of interaction.
 
Hope this helps in the continuing of your investigation. 
 
Cheers,


Jaime Rosales D.
Sr. Developer Consultant
Twitter | AEC ADN DevBlog
0 Likes
Message 7 of 12

AnatolyCEL
Enthusiast
Enthusiast

Hello Jaime,

My manager sent the message about this problem:

 

“Dear rosalesduquej. Thank you for your valuable support. The solution for the problem is found. The reason for the problem is that the “Duct\Pipe Size” command is not postable as many others. We can watch three events for every postable command, and we would like to have this functionality for every Revit command. Or, at least for some of them. The “Duct\Pipe Size” command is a good candidate for this. I think there are many other commands which ware not considered before as postable, but they can get this functionality. Is it possible to do more “postable” commands in Ribbon menu?

 

Best Regards,

Evgeny. “

 

Thanks,

Anatoly.

0 Likes
Message 8 of 12

rosalesduquej
Alumni
Alumni

Hi Anatoly,

 

Thank you for forwarding me this information. I have a couple of requests for you. Could you share how did you guys solved your request? Was the information I provided about the Jrn.ComboBox the one that helped solve your question?

 

Question in regards one part of your manager's text "We can watch" or is it "can't"?. And if I understand you guys are requesting the consideration for more postable commands right? If so could you send me your emails via a private message so I can talk to you guys and also understand the reason of the request. I will need it in order to talk to the Revit engineers for consideration. 

 

Cheers,



Jaime Rosales D.
Sr. Developer Consultant
Twitter | AEC ADN DevBlog
0 Likes
Message 9 of 12

AnatolyCEL
Enthusiast
Enthusiast

Hi Jaime,

 

Duct/Pipe Sizing command raises UIControlledApplication.DialogBoxShowing Event. I put my code into the handler of this event.

 

Thanks,

Anatoly.

0 Likes
Message 10 of 12

rosalesduquej
Alumni
Alumni

Hi Anatoly,

 

Thanks for letting me know, Will it be too much to ask for a small sample on how this code is working? A couple of screenshots will be useful as well. I'm curious to see how this works, since I have never tried it. Sharing this with the community is also very helpful since future related questions will come up and the community can reference to your post. 

 

Thank you so much for your collaboration. 

Cheers,



Jaime Rosales D.
Sr. Developer Consultant
Twitter | AEC ADN DevBlog
0 Likes
Message 11 of 12

dsmith
Advocate
Advocate

Jaime/Anatoly

 

I am very interested in your solution, is there a chase you can share a sample of your code for all to see.

 

Regards

 

Dave

0 Likes
Message 12 of 12

AnatolyCEL
Enthusiast
Enthusiast

When Revit starts:

public Result OnStartup(UIControlledApplication application)
{
        application.DialogBoxShowing += dialogBoxShowing;
}

private void dialogBoxShowing(object source, DialogBoxShowingEventArgs args)
{
      // Duct/Pipe Sizing Dialog
      if (args.HelpId.Equals(1031))
      {
            UIDocument uiDoc = (source as UIApplication).ActiveUIDocument;
            ICollection<ElementId> selIds = uiDoc.Selection.GetElementIds();
            foreach (ElementId elementId in selIds)
            {
                 // All required actions
            }
      }
}

 

Thanks,

Anatoly.

0 Likes