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

AssemblyHalfSectionViewCmd - how to carry out via ilogic?

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?

A.Acheson
in reply to: jpi656UL

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
in reply to: jpi656UL

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)

jpi656UL
in reply to: jpi656UL

Dear @WCrihfield,

 

"AppContextual_DoneCmd" worked perfectly

 

Thank you! :slightly_smiling_face: