Select Revit UI from ExternalCommand

Select Revit UI from ExternalCommand

jjesusdelpino
Advocate Advocate
526 Views
2 Replies
Message 1 of 3

Select Revit UI from ExternalCommand

jjesusdelpino
Advocate
Advocate

Hi forum. Probably being a little punctilious here but.. The thing is that I want to go the Revit and select some stuff, the come back to my form. This code is working so far:

 

MyForm.WindowState = FormWindowState.Minimized; //minimize my form to see the revit window
myRef = uidoc.Selection.PickObjects(ObjectType.Element, "Select elements");
MyForm.WindowState = FormWindowState.Normal; //Take my form back.

 

I dont know if its the best way to handle this problem, but as its working its ok for me. My problem with this code is that just before selecting the Revit elements, I have to click somewhere in the Revit screen to select the UI, then I can select elements normally. I know this may be a little punctilious but, how could I save this one extra click and select Revit directly from my addin?

 

Regards.

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

Sean_Page
Collaborator
Collaborator
Accepted solution

Does this link perhaps contain some clues?

 

https://thebuildingcoder.typepad.com/blog/2017/10/modeless-form-keep-revit-focus-and-on-top.html

 

Keep in mind that I believe the process / calls have changed in recent versions of Revit.

Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
0 Likes
Message 3 of 3

jjesusdelpino
Advocate
Advocate

Thanks like always Spage. Im missing some references from that example but Im gonna give it a deeper look. Thanks.

 

Regards.

0 Likes