Switch Design views representation for multiple occurences at once

Switch Design views representation for multiple occurences at once

FINET_Laurent
Advisor Advisor
380 Views
5 Replies
Message 1 of 6

Switch Design views representation for multiple occurences at once

FINET_Laurent
Advisor
Advisor

Hi folks,

 

Is it possible to switch design view representations of multiple occurences (assemblies) in one go ? 
You can indeed select multiple sub-assemblies by hand, then right-clikc Representation. A window pops up and asks you to choose which one you want. When clicking OK,  it activates the desired view rep, for all the sub-assemblies in one go. I would like to achieve this by code.

 

As for now, I'm adding the occurences in the select set, and use the command manager to fire the same command as you would do by hand :

Dim mngr As CommandManager = g_inventorApplication.CommandManager
mngr.ControlDefinitions.Item("AssemblyRepresentationsCmd").Execute()

 

The desired window pops up :

FINET_Laurent_0-1695287381596.png

 

I would like to be able to then control the window. Is it possible ?

Has anyone a better idea ? 

 

Thank you and kind regards,

FINET L.

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

0 Likes
381 Views
5 Replies
Replies (5)
Message 2 of 6

A.Acheson
Mentor
Mentor

Hi @FINET_Laurent 

 

Generally using the command manager and control definitions are a last resort for the very reason your asking the lack of control. Once launched the commands are asking for user input using keyboard and mouse. You can do keystrokes usinf send keys for these but they are open to user Interuption and some I have found simply don't respond to keyboard strokes so you are only left with controlling the mouse which is harder again.  All the operations in that dialog box are in the API so you would just need a select set or object collection of occurrences and away you go. 

 

Syntax

ComponentOccurrence.SetDesignViewRepresentationRepresentation As String, [Reserved] As String, [Associative] As Boolean )

 

Syntax

ComponentOccurrence.ActivePositionalRepresentation() As String

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 6

FINET_Laurent
Advisor
Advisor

@A.Acheson,

 

Actually I don't want to loop through the select set and fire the command each time. 
I would rather have the behaviour explained above.
I know you can feed the PostPrivateEvent with informations, like so : Inventor 2024 Help | Post Private Event Sample | Autodesk

I was hoping this would also work on this window. 

 

Kind regards,

FINET L.

 

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

0 Likes
Message 4 of 6

A.Acheson
Mentor
Mentor

Hi @FINET_Laurent 

This name value map sample is new to 2024. I haven't seen it in previous inventor version. Without some more samples/help file on how to use this for the various commands or a lot of trial and error I would think this is like walking in the dark. If you want further info on using this in your specific task I would say calling in Mike Deck might be the only way to get more of an idea how to proceed. Using the API would be my preference for this really. 

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

FINET_Laurent
Advisor
Advisor

Calling in @MjDeck then.. 

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

0 Likes
Message 6 of 6

MjDeck
Autodesk
Autodesk

Hi @FINET_Laurent , what are the advantages of using the command rather than the 

ComponentOccurrence.SetDesignViewRepresentation( Representation As String, [Reserved] As String, [Associative] As Boolean )

 API?


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes