Native Revit Command Inside Custom Command

Native Revit Command Inside Custom Command

Chuck.Ross
Advocate Advocate
166 Views
3 Replies
Message 1 of 4

Native Revit Command Inside Custom Command

Chuck.Ross
Advocate
Advocate

Is it possible to run/call native Revit commands inside a custom command?

 

For instance, inside my custom command, I'd like to call the native Revit command "Set Workplane" and then continue with my custom tool making use of this newly set workplane.

 

Thanks for any help with this.

 

Chuck

0 Likes
167 Views
3 Replies
Replies (3)
Message 2 of 4

jeremy_tammik
Alumni
Alumni

Yes. The "continue" aspect is a bit tricky, though. You can use PostCommand to request execution of a native command X, cf. The Building Coder topic group on that with lots of samples:

  

  

However, you need to terminate your running command to let the native command X execute. Then, you need to subscribe to the Revit Idling event to be notified when X has completed. In the Idling event handler, you can pick up and continue where you left off, or rather, where X left off.

  

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

Chuck.Ross
Advocate
Advocate

@jeremy_tammik,

 

Thank you for the response! I am new to coding, so this is above my understanding, for now. 🙂 However, you have provided some tantalizing breadcrumbs to follow. I will research how to make this work, as it seems a super powerful way to combine custom tools and the power of native Revit tools. If you have more specific guidance or code examples I'd be happy to check them out.

 

Enjoy the day!

 

Chuck

0 Likes
Message 4 of 4

rhanzlick
Advocate
Advocate

This is the way - it's hacky and quite (over?) complicated, but I have had success with this approach.

0 Likes