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

iLogic and Form Combination To Control View Representations and Positions

Hello, 

 

I have a model that needs 10 positions and 35 view representations.  This is due to us having 10 Types of item and they can be configured in different positions.  Ideally I would like to be able to toggle the position and view representations by means of a form.

 

I am wondering if this can be achieved by means of a multiple-value text parameter.  For example if the text parameter was "Product Type 1" the code would give it "View 1" and "Position 1".  If the code was easy enough to work with I can copy and paste the lines in the same iLogic code for each position - ie "Product Type 2" = "View 2" + "Position 1".  

Alternatively, if it makes things simpler, I could create a view representation and a positional representation with matching names that would be equal to the text parameter.  If the code can handle that and apply the view and position to match the multi-value text parameter chosen, I can work with that also.

 

Is this achievable?  The whole purpose is to streamline the model so users can check clashes in different positions with different items in the machine.

 

Thanks in advance

Hi @Cadderman 

 

Something like this should work. The first example sets the list and uses an input box (rather than a form) ... but if you had the form and list already set up you could use something like the 2nd example.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

Curtis_Waguespack_1-1655225771167.png

 

1st example

oTrigger = ProductConfig
MultiValue.SetList("ProductConfig", "Product Type 1", "Product Type 2")

oInput = InputListBox("Prompt", MultiValue.List("ProductConfig"), _
"", "iLogic", "List")

If oInput = "" Then Return 'exit rule

Dim oDoc As Document
Dim oDef As ComponentDefinition
oDoc = ThisApplication.ActiveDocument
oDef = oDoc.ComponentDefinition

oDef.RepresentationsManager.DesignViewRepresentations.Item(oInput).Activate
oDef.RepresentationsManager.PositionalRepresentations.Item(oInput).Activate

ThisApplication.ActiveView.Fit

 

2nd example

Dim oDoc As Document
Dim oDef As ComponentDefinition
oDoc = ThisApplication.ActiveDocument
oDef = oDoc.ComponentDefinition

oDef.RepresentationsManager.DesignViewRepresentations.Item(ProductConfig).Activate
oDef.RepresentationsManager.PositionalRepresentations.Item(ProductConfig).Activate

ThisApplication.ActiveView.Fit

 

Hi @Cadderman ,

For the case with more View reps than positional reps, where multiple products use the same positional reps, you could use something like this ( assuming the parameter list and form are already set up).

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Curtis_Waguespack_0-1655226335635.png

 

 

Select Case ProductConfig

	Case "Product Type 1"
		oViewRep = "Product Type 1"
		oPosRep = "PosView1"
	Case "Product Type 2"
		oViewRep = "Product Type 2"
		oPosRep = "PosView2"
	Case "Product Type 3"
		oViewRep = "Product Type 3"
		oPosRep = "PosView1" 
End Select


Dim oDoc As Document
Dim oDef As ComponentDefinition
oDoc = ThisApplication.ActiveDocument
oDef = oDoc.ComponentDefinition

oDef.RepresentationsManager.DesignViewRepresentations.Item(oViewRep).Activate
oDef.RepresentationsManager.PositionalRepresentations.Item(oPosRep).Activate

ThisApplication.ActiveView.Fit

 

 

 

Hi @Curtis_Waguespack 

 

Thanks for the codes! I'm just trying to use them in a test model to try out the iLogic.  It works great, thank you so much!

 

SteveK88
in reply to: Cadderman

FYI, less text using RepresentationsManager......

 

Select Case Position

	Case "Sitting"
		oViewRep = "View1"
		oPosRep = "Sitting"
	Case "Reaching"
		oViewRep = "View1"
		oPosRep = "Reaching"
	Case "Working"
		oViewRep = "View1"
		oPosRep = "Working" 
End Select

ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.DesignViewRepresentations.Item(oViewRep).Activate
ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.PositionalRepresentations.Item(oPosRep).Activate

ThisApplication.ActiveView.Fit