Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

AssemblyHalfSectionViewCmd - how to carry out via ilogic?

jpi656UL
Participant

AssemblyHalfSectionViewCmd - how to carry out via ilogic?

jpi656UL
Participant
Participant

Hi guys,

 

I was looking for an information to automate section view for the assembly and to be honest I stuck here:

ThisApplication.ActiveDocument.SelectSet.Select(assm.ComponentDefinition.WorkPlanes.Item("XY Plane"))
ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyHalfSectionViewCmd").Execute

now the window pops up and I need to hit  ok button:

jpi656UL_0-1669906891071.png

 

I found some information to use 

SendKeys 

to close the window resulting with execution but apparently it is no longer supported.

 

Can anyone help me with this? Isn't it possible any longer?

0 Likes
Reply
Accepted solutions (1)
244 Views
3 Replies
Replies (3)

A.Acheson
Mentor
Mentor

It is still supported see send key string

 

 

SendKeys.SendWait("ENTER")

 

 It is a little tricky to control these commands as you are effectively sending the inputs after the dialogue has opened so it can get mixed results. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan

WCrihfield
Mentor
Mentor
Accepted solution

Hi @jpi656UL.  Also when using SendKeys, you have to make sure that the dialog you want to send the keystrokes to has 'system focus' when they are 'sent out', because the keystrokes could get sent to the wrong place, which is why it is dangerous.  I often precede the SendKeys line with AppActivate(ThisApplication.Caption), but even that if fairly vague.  There is also a more advanced vb.net function usually called "SetForegroundWindow" that you could use there, if you were proficient in your vb.net.  Then use "ThisApplication.UserInterfaceManager.DoEvents" on the line after calling SendKeys, to force it to be processed right then.

 

Or, you might be able to skip using the SendKeys altogether, and execute another command.  There are several that sound about right, such as "AppContextual_DoneCmd", "AppContextual_ApplyCmd", "AppContextual_OKCmd", "AppContextual_ContinueCmd", "AppContinueCmd", "Continue", "Done",  etc.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes

jpi656UL
Participant
Participant

Dear @WCrihfield,

 

"AppContextual_DoneCmd" worked perfectly

 

Thank you! :slightly_smiling_face:

0 Likes