Inventor General Discussion

Inventor General Discussion

Reply
Distinguished Contributor
amasva
Posts: 290
Registered: ‎01-02-2007
Message 1 of 4 (682 Views)
Accepted Solution

pos rep, view rep and ilogic

682 Views, 3 Replies
03-15-2012 12:32 AM

Hi

Is it in ilogic possible to check which pos rep that is active using a rule? Is it possible to activate a view rep using a rule?

 

I'd like to do something like:

If this "pos rep name" is active, then activate this "view rep name"

 

 

Asle Martin Svastuen
Autodesk Product Design Suite Ulitmate 2012 Sp1 / Vault Collaboration 2012 Sp1
HP EliteBook 8560w
Intel(R)Core(TM) i7 CPU Q 720 @ 2,0GHz 2,0GHz
16GB RAM
Windows 7 X64 SP1

Hi amasva, 

 

Here is an example that might help, along with some sample files.

 

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

 

' 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
oAsmCompDef.RepresentationsManager.PositionalRepresentations.Item("Stacked").activate
ElseIf oAsmCompDef.RepresentationsManager.ActivePositionalRepresentation.Name = "Stacked" Then
oAsmCompDef.RepresentationsManager.PositionalRepresentations.Item("Master").activate
End if
'set View Representation based on of the active Positional Representation
If oAsmCompDef.RepresentationsManager.ActivePositionalRepresentation.Name = "Master" Then
oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("Blue").activate
ElseIf oAsmCompDef.RepresentationsManager.ActivePositionalRepresentation.Name = "Stacked" Then
oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("Red").activate
End if

 

Employee
Yijiang.Cai
Posts: 359
Registered: ‎05-20-2008
Message 2 of 4 (674 Views)

Re: pos rep, view rep and ilogic

03-15-2012 02:01 AM in reply to: amasva

I did not get the existing function in iLogic, but this can be accomplished via Inventor API -

Sub Main()
    Dim oDoc As AssemblyDocument
    Set oDoc = ThisApplication.ActiveDocument
   
    Dim oCompDef As AssemblyComponentDefinition
    Set oCompDef = oDoc.ComponentDefinition
   
    Dim sActivePR As String
    sActivePV = oCompDef.RepresentationsManager.ActivePositionalRepresentation.Name
   
    Dim sActiveDV As String
    sActiveDV = oCompDef.RepresentationsManager.ActiveDesignViewRepresentation.Name
   
    Dim sActiveLOD As String
    sActiveLOD = oCompDef.RepresentationsManager.ActiveLevelOfDetailRepresentation.Name
End Sub

 

And you could also use this code sample in iLogic, and maybe the error shows up, and you could remove the "Set" in code line to fix it.

 

Thanks,
River

Thanks,
River Cai

Inventor Quality Assurance Team
Autodesk, Inc.
*Expert Elite*
Curtis_Waguespack
Posts: 2,942
Registered: ‎03-08-2006
Message 3 of 4 (659 Views)

Re: pos rep, view rep and ilogic

03-15-2012 09:27 AM in reply to: amasva

Hi amasva, 

 

Here is an example that might help, along with some sample files.

 

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

 

' 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
oAsmCompDef.RepresentationsManager.PositionalRepresentations.Item("Stacked").activate
ElseIf oAsmCompDef.RepresentationsManager.ActivePositionalRepresentation.Name = "Stacked" Then
oAsmCompDef.RepresentationsManager.PositionalRepresentations.Item("Master").activate
End if

'set View Representation based on of the active Positional Representation
If oAsmCompDef.RepresentationsManager.ActivePositionalRepresentation.Name = "Master" Then
oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("Blue").activate
ElseIf oAsmCompDef.RepresentationsManager.ActivePositionalRepresentation.Name = "Stacked" Then
oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("Red").activate
End if

 



  solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.





Distinguished Contributor
amasva
Posts: 290
Registered: ‎01-02-2007
Message 4 of 4 (645 Views)

Re: pos rep, view rep and ilogic

03-15-2012 11:22 PM in reply to: Curtis_Waguespack

Thank you very much Curtis :smileyhappy:

Asle Martin Svastuen
Autodesk Product Design Suite Ulitmate 2012 Sp1 / Vault Collaboration 2012 Sp1
HP EliteBook 8560w
Intel(R)Core(TM) i7 CPU Q 720 @ 2,0GHz 2,0GHz
16GB RAM
Windows 7 X64 SP1
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.