Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Changing Positional Representation of SubAssembly Using iLogic

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
Calico5
4946 Views, 9 Replies

Changing Positional Representation of SubAssembly Using iLogic

Hello,

 

I tried searching the forums but couldnt find a solution. 

 

The problem

- I have a top level assembly (lets call it '01.iam', which contains a range of subassemblies (e.g. '02.iam', '03.iam' etc)

- The subassemblies have positional representations

- I want to be able to manipulate the pos.rep's from the top level using iLogic. 

 

I found this snippet of code on the forum which works when I create the rule in one of the subassemblies. 

 

ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.PositionalRepresentations("MyPosRep").Activate

 But I'm having trouble adapting it to work from the top level, as I would like all my rules saved in one place. 

 

Any help or information will be much appreciated,

 

Regards

9 REPLIES 9
Message 2 of 10
MjDeck
in reply to: Calico5

You should be able to do it with the API method PositionalRepresentation.SetPositionalRepresentationOverride.

But maybe you don't need to set the subassembly posreps independently using code?  If you want a subassembly to switch to MyPosRep when the top-level assembly is switched, you can tie them together manually.  At the top level, while MyPosRep is active, right click on the subassembly and choose Representation...  Select MyPosRep in the subassembly.  Then the posreps will be tied together.

SubAssemPosRep.png


Mike Deck
Software Developer
Autodesk, Inc.

Message 3 of 10
Calico5
in reply to: MjDeck

Thanks again Mike, can't believe I didnt think of doing that! 

 

Your help is much appreciated,

Regards

 

Message 4 of 10
martjonker
in reply to: MjDeck

Goodmorning,

 

I have the same problem, but for me its not possible to tie the pos reps together. I'm configuring a band with different supports. Each support is configured with a range; 600-900, 900-1200, 1200-1500 etc. those ranges can be adjust by 50mm and those steps are specified by the pos reps (see attached image).

All the different supports are put in the top assembly and in this assembly I want to switch between the positional representations. I tried to use: 

 

ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.PositionalRepresentations("MyPosRep").Activate

 

But it won't work. I guess I have to replace "ComponentDefinition" in one way or another to the component name, but I don't know how.

 

I hope you understand my problem and you are able to help me!

 

-Mart

Message 5 of 10
martjonker
in reply to: martjonker

Band = conveyor-belt.

Message 6 of 10
ben_neb43
in reply to: MjDeck

Future readers...

 

It seems that you can't change the Positional representation this way:

Capture.PNG

But you can change Positional representations this way

Capture2.PNG

Message 7 of 10
shoemara
in reply to: ben_neb43

Can someone provide an update for this thread using iLogic?

 

I would like to be able to change the Positional Representation of a SubAssembly using iLogic. This is the only thread that talks about it and it is done using iLogic from 2009. 

Message 8 of 10
ben_neb43
in reply to: shoemara

I tried a long time ago, and not sure that it's possible. Do you have any I logic code to look at?
Message 9 of 10
shoemara
in reply to: ben_neb43

The best I've come up with is to have a subassembly that has Rep-pos and then insert it into an assembly and create rep-pos in that assembly with the same name as the subassembly and then use the following code: 

 

SyntaxEditor Code Snippet

' set a reference to the assembly component definintion.
' This assumes an assembly document is open.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

'toggle Between Positional Representations
'If oAsmCompDef.RepresentationsManager.ActivePositionalRepresentation.Name = "Master" Then
If Width = 3 Then
oAsmCompDef.RepresentationsManager.PositionalRepresentations.Item("3").Activate
End If
If Width = 4 Then
oAsmCompDef.RepresentationsManager.PositionalRepresentations.Item("4").Activate
End If
If Width = 5 Then
oAsmCompDef.RepresentationsManager.PositionalRepresentations.Item("5").Activate
End If

 

It does change the rep-pos of the top level and the sub assembly. But you can only save in the Master rep-pos so this method does not work.

Message 10 of 10
KCasupanan
in reply to: ben_neb43

this is the same problem I had. But its fixed now! Thanks! 

 

NOTE: make sure your "top assembly" and "sub assembly" positional representation has the SAME spelling & capitalization; otherwise it wont work.

 NOTE: if you follow ben_neb43 steps, you will see your subassembly has (override) on it

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report