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: 

Pass the Duct width & height to the internal duct drawing command?

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
natanatalili
474 Views, 5 Replies

Pass the Duct width & height to the internal duct drawing command?

Hi everyone,

I have been able to create a duct of specific width and height and add it to the project using doc.Create.NewDuct.

However, my target is to pass the width and height variabls to the internal duct drawing command (the one in the ribbon), is it possible? Thanks.

5 REPLIES 5
Message 2 of 6
jeremytammik
in reply to: natanatalili

Dear Lovetvseries,

 

No, I do not believe this is possible just like that.

 

What you can do, however, is determine the default type for the built-in command to place.

 

Look at the new Default Type API introduced in Revit 2015:

 

http://thebuildingcoder.typepad.com/blog/2014/04/whats-new-in-the-revit-2015-api.html#3.02

 

For instance, you can take a look at the SetDefaultFamilyTypeId method and the GetSetDefaultTypes SDK sample:

 

/a/lib/revit/2015/SDK_ur2/Samples/GetSetDefaultTypes/CS/DefaultFamilyTypes.xaml.cs

 

Once you have set the default type to the required dimensions, you can launch the built-in command using PostCommand.

 

I hope this helps.

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 6
hvarjus
in reply to: jeremytammik

I'm not sure but I think that Jeremy Tammik's solution doesn't solve the problem because you cannot set dimensions for DuctType. Width and height are instance parameters so I think that Jeremy's solutions doesn't work. It starts duct drawing but it uses last given width and height values. However if I'm wrong I'm intrested to hear how those dimensions are possible to set so that they are active when PostCommand is started.

 

 

 

Message 4 of 6
jeremytammik
in reply to: hvarjus

Dear Hvarjus,

 

Thank you for your comments. You are very probably right. If the default type API cannot be used in this way, all I can think of suggesting is to insert a duct of the desired type and dimensions and then launch the 'Create Simiilar' command as suggested a long time ago for walls:

 

http://thebuildingcoder.typepad.com/blog/2010/11/launching-a-revit-command.html

 

Dear Lovetvseries, please let us know whether this helps and what solution you end up implementing.
 

Thank you!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 6
hvarjus
in reply to: jeremytammik

Dear Jeremy,

 

I think so too that this "Create Similar" trick is only way to solve the problem with current Revit API. Your sample code is very old so Revit API currently offer little better method to start command via PostCommand method.

 

 

 

 

Message 6 of 6
jeremytammik
in reply to: hvarjus

any volunteers?   🙂



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community