problem about using controlDefinition("AppProjectGeometryWrapperCmd") to project sketch entities

problem about using controlDefinition("AppProjectGeometryWrapperCmd") to project sketch entities

junGQMXK
Enthusiast Enthusiast
388 Views
2 Replies
Message 1 of 3

problem about using controlDefinition("AppProjectGeometryWrapperCmd") to project sketch entities

junGQMXK
Enthusiast
Enthusiast

hello, everyone,

 

I used the controlDefinition("AppProjectGeometryWrapperCmd") to mimic the UI project geometry command to project some sketch entities from sketch A in part component A to sketch B in part component B in an assembly.

 

the program ran very well. however, at the end of the program after I used the following fragment to exit editing status of sketch B and part component B, Inventor still stayed in the input status of UI project geometry, asking me to “select edge,vertex, work geometry, part face oor sketch geometry to project”.

 

when I moved the cursor or tried to select something, Inventor crashed. But if I did not select anything with the cursor and just pressed “ESC” to exit, then everything was ok.

 

 

 

ThisApplication.CommandManager.ControlDefinitions.Item("AppProjectGeometryWrapperCmd").Execute
oSketch2Proxy.ExitEdit
oAsmCompDef.ActiveOccurrence.ExitEdit(kExitToPrevious)

 

it seems that I was missing some instructions to “completely exit editing status”. But what was I missing?

 

any ideas?

 

thanks in advance

thanks in advance.

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

WCrihfield
Mentor
Mentor
Accepted solution

My best guess is that you need to send a command or keyboard key to that active command, right after you have used it, and before exiting the sketch and component.  I have suggested using the SendKeys.SendWait() tool to send the Esc key before, but that is usually a last resort.  You may be able to just execute another command there.  There are several general commands for similar situations, but when in that tool, I believe you have the OK and Cancel options that will get you out of the selection mode of that command, so one of those is most likely the right tool for the job here.  I believe the commands for sending those signals are "AppContextual_OKCmd" & "AppContextual_CancelCmd".  Give one of those a try right after your "AppProjectGeometryWrapperCmd" execution.

 

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡 or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

junGQMXK
Enthusiast
Enthusiast

Thanks @WCrihfield :

 

thank you very much. Your post directed me in the right direction.\

 

I tried the the 2 commands mentioned by you : "AppContextual_OKCmd" & "AppContextual_CancelCmd",

the command "AppContextual_CancelCmd" does work.

 

you are right, after the command "AppProjectGeometryWrapperCmd" , the program does not exit the editing status automatically. we must send some other command to help the program to exit the editing status.

 

 

ThisApplication.CommandManager.ControlDefinitions.Item("AppProjectGeometryWrapperCmd").Execute

ThisApplication.CommandManager.ControlDefinitions.Item("AppContextual_CancelCmd").Execute

 

 

 

 

I have learned something from you. 

 

thank you very much again.

 

 

 

0 Likes