Inventor General Discussion

Inventor General Discussion

Reply
Valued Contributor
dclunie
Posts: 70
Registered: ‎03-26-2008
Message 1 of 2 (167 Views)
Accepted Solution

ILOGIC CODE TO SWITCH G_ W & G_T

167 Views, 1 Replies
02-05-2013 12:35 AM

HI All

 

I am after some code to enable the switching of parameter name's

 

I need the following if i could have some help

 

  1. Change user parameter G_W in paramters dialog box to   G_T
  2. Change user parameter G_T in paramters dialog box to  G_W

basically i want them to swap over and i will be running this as a external rule.

 

Any help will be appreciated

 

 

 

 

 

Dave

This code can do the job for you:

 

Rob.

'create a temporary variable and assign names to them
SharedVariable("OrigG_W") = Parameter.Param("G_W").Name
SharedVariable("OrigG_T") = Parameter.Param("G_T").Name

'rename the current parameters with a temporary name
Parameter.Param("G_W").Name = "OrigG_W"
Parameter.Param("G_T").Name = "OrigG_T"

'rename the temporary parameter name to the one from the sharedvariable
Parameter.Param("OrigG_W").Name = SharedVariable("OrigG_T")
Parameter.Param("OrigG_T").Name = SharedVariable("OrigG_W")

'remove all the sharedvariable
SharedVariable.RemoveAll()
Distinguished Contributor
VdVeek
Posts: 117
Registered: ‎09-13-2012
Message 2 of 2 (151 Views)

Re: ILOGIC CODE TO SWITCH G_ W & G_T

02-05-2013 04:26 AM in reply to: dclunie

This code can do the job for you:

 

Rob.

'create a temporary variable and assign names to them
SharedVariable("OrigG_W") = Parameter.Param("G_W").Name
SharedVariable("OrigG_T") = Parameter.Param("G_T").Name

'rename the current parameters with a temporary name
Parameter.Param("G_W").Name = "OrigG_W"
Parameter.Param("G_T").Name = "OrigG_T"

'rename the temporary parameter name to the one from the sharedvariable
Parameter.Param("OrigG_W").Name = SharedVariable("OrigG_T")
Parameter.Param("OrigG_T").Name = SharedVariable("OrigG_W")

'remove all the sharedvariable
SharedVariable.RemoveAll()
Autodesk Inventor 2015 Certified Professional & Autodesk Inventor 2012 Certified Professional.
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!