"Edit View" representation api/iLogic command

"Edit View" representation api/iLogic command

DarthBane55
Advisor Advisor
607 Views
7 Replies
Message 1 of 8

"Edit View" representation api/iLogic command

DarthBane55
Advisor
Advisor

Full disclosure:  I am sorry to those who saw this before...  I posted this a few days ago, but it was under an already solved question I had, and it might not have triggered people to look because it was already marked as solved.  I am putting it under a new topic in the hope that someone will be able to help.

 

I need to run the command "edit view" from under the view representation (it's under right click on a view representation). I got a long list of inventor commands, but this is not in the list I have.  Is there a command we can call to run this "edit view" from code?

I would run this, except I would replace the "AssemblyVisibilityCtxCmd" with actual command for "edit view".  This would have to be run from the "active" view representation:

Dim oControlDef As ControlDefinition = ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyVisibilityCtxCmd")
oControlDef.Execute()

 If this command is not available to run from code, I created a keyboard shortcut in Inventor to run it.  I assigned "ctrl+E" to run the "edit view" command.  It works when I do the keystroke manually, but it does not from code.

Here's the code I have for this (I tried many variance on the brackets and whatnot but I can't make it work):

AppActivate(ThisApplication.Caption)
System.Windows.Forms.SendKeys.SendWait("{^E}")

Would anyone be able to help me, with either one of these solutions?

0 Likes
Accepted solutions (1)
608 Views
7 Replies
Replies (7)
Message 2 of 8

A.Acheson
Mentor
Mentor

Is the button called edit include components? If not can you post an image of  the exact location and name with also the version you are using. Also what is the entire workflow you are looking to achieve. There might be methods in the API apart from using the command approach

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 8

DarthBane55
Advisor
Advisor

Hi @A.Acheson , thank you for the reply.

Here is a screenshot of the button.  This button allows to select hidden parts, to unhide them.  I am doing something extra to this, thus the need to activate it from code.

1.png

0 Likes
Message 4 of 8

WCrihfield
Mentor
Mentor
Accepted solution

The command behind that tool appears to be called "SimplificationShowHideComponentContextCmd".

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 8

DarthBane55
Advisor
Advisor

@WCrihfield 

wow, thank you very much!!!  Extremely appreciated!  That was it indeed.

To add an extra layer, when you run this command, there is a sub menu that pops up with 3 options:

-View all, View Included, View excluded.

The 1st time of the day, it defaults to "view all".  Would you know if there is something else that can be done from code to force it to default to "view excluded"?  I might be pushing it on that one, but just in case I thought I'd ask.

Other than that, this is exactly what I was looking for. 

I see now that running this mid-code resets my variable array, maybe I can find a solution on that to make the variables Public or something like that, I'll play with that.

Thanks again!

0 Likes
Message 6 of 8

WCrihfield
Mentor
Mentor

I do not know how of any simple way to accomplish that right now.  There may be an elaborate, longer route to essentially simulate its effects of changing that secondary setting, but I trying to do other things by code while this command is active, and in a selection mode, most likely won't work as intended.  I would say that this may be one of those things that you either want to do completely manually, or completely by code, because trying to mix the two in this case may be more troublesome or inefficient than it's worth.  I do believe that the functionality that this command is for can be done through other means, but likely won't be as nice or as efficient as the built-in manual process, unless you plan on identifying the items you want to adjust through other means, other than manual selection, and won't have to change those items each time you run the rule to make it work.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 7 of 8

DarthBane55
Advisor
Advisor

@WCrihfield Looks like you know it... I've been at it for a while last nite, and when this command is executed, the rest of my code runs immediately, it won't wait for the user to be done with the Inventor command, so my code runs before it should, and the result is that it doesn't work.  I think I gave up now, I tried many things, but I can't get the code to wait.

0 Likes
Message 8 of 8

WCrihfield
Mentor
Mentor

If what you were trying to achieve here was an important step in a larger workflow you had in mind, you might still be able to achieve a similar outcome using other code to automate it, but just avoid executing that command as a means to accomplish it.  There is likely more than one way to do whatever task you were trying to do with that command.  You may need to break your code up into sub routines and/or sub functions or something, with one section dedicated specifically for taking care of that one part of the job.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes