Inventor Customization

Inventor Customization

Reply
Distinguished Contributor
dodrain
Posts: 204
Registered: ‎02-11-2010
Message 1 of 2 (327 Views)
Accepted Solution

Changing Positional Representation Using iLogic

327 Views, 1 Replies
01-16-2013 11:54 AM

Can anybody help me what command i neet to use to change between different Positional Representations?

 

 

Hi dodrain,

 

Attached is a sample assembly that has this rule in it.

 

The rule gets the active Positional rep, then gets all of the Positional rep names and adds them to a list, then presents the list to the user and automatically sets the active Positional rep as the default in the list. Then either sets the selected Positional rep active or creates a new one, based on the user input.

 

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 definition.
 'This assumes an assembly document is open.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

'define pos rep
Dim oPosRep As PositionalRepresentation
Dim sPosRep As String
Dim MyArrayList As New ArrayList

'record the active view rep name
Dim sActivePosRep as String
sActivePosRep = oAsmCompDef.RepresentationsManager.ActivePositionalRepresentation.Name

For Each oPosRep In oAsmCompDef.RepresentationsManager.PositionalRepresentations
MyArrayList.add(oPosRep.Name)
Next

iArrayList = MyArrayList.Count
MyArrayList.add("*Add a new Positional Rep*")

sPosRep = InputListBox("Select from the list:", MyArrayList, sActivePosRep, "iLogic", "Positional Reps")

If sPosRep = "*Add a new Positional Rep*" Then
newPosRep = InputBox("Enter a name:", "iLogic", "New Pos Rep_" & iArrayList)
newAngle = InputBox("Enter an Angle:", "iLogic", "5")
'create new pos rep
oAsmCompDef.RepresentationsManager.PositionalRepresentations.Add(newPosRep)
myAngle = newAngle
Else
'activate the selected pos rep
oAsmCompDef.RepresentationsManager.PositionalRepresentations.Item(sPosRep).Activate    
End If

'zoom all
ThisApplication.ActiveView.Fit

 

*Expert Elite*
Curtis_Waguespack
Posts: 2,986
Registered: ‎03-08-2006
Message 2 of 2 (320 Views)

Re: Changing Positional Representation Using iLogic

01-16-2013 01:35 PM in reply to: dodrain

Hi dodrain,

 

Attached is a sample assembly that has this rule in it.

 

The rule gets the active Positional rep, then gets all of the Positional rep names and adds them to a list, then presents the list to the user and automatically sets the active Positional rep as the default in the list. Then either sets the selected Positional rep active or creates a new one, based on the user input.

 

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 definition.
 'This assumes an assembly document is open.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

'define pos rep
Dim oPosRep As PositionalRepresentation
Dim sPosRep As String
Dim MyArrayList As New ArrayList

'record the active view rep name
Dim sActivePosRep as String
sActivePosRep = oAsmCompDef.RepresentationsManager.ActivePositionalRepresentation.Name

For Each oPosRep In oAsmCompDef.RepresentationsManager.PositionalRepresentations
MyArrayList.add(oPosRep.Name)
Next

iArrayList = MyArrayList.Count
MyArrayList.add("*Add a new Positional Rep*")

sPosRep = InputListBox("Select from the list:", MyArrayList, sActivePosRep, "iLogic", "Positional Reps")

If sPosRep = "*Add a new Positional Rep*" Then
newPosRep = InputBox("Enter a name:", "iLogic", "New Pos Rep_" & iArrayList)
newAngle = InputBox("Enter an Angle:", "iLogic", "5")
'create new pos rep
oAsmCompDef.RepresentationsManager.PositionalRepresentations.Add(newPosRep)
myAngle = newAngle
Else
'activate the selected pos rep
oAsmCompDef.RepresentationsManager.PositionalRepresentations.Item(sPosRep).Activate    
End If

'zoom all
ThisApplication.ActiveView.Fit

 



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





Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!