Inventor Customization

Reply
Distinguished Contributor
art_turner
Posts: 213
Registered: ‎04-01-2008
Message 1 of 5 (294 Views)
Accepted Solution

Ilogic Change Parameter in any Part that is not a component

294 Views, 4 Replies
10-01-2013 02:43 PM

can you tell what i want to do here. the commented code does not work.

 

i want to be able to open a part and change its size parameters before i open the assembly. this code will run as an external rule in a new empty file. 

 

if i can do it without opening the part, that is even better.

 

'test can i open a part, change a param, then close part

Dim fname As String

fname ="C:\Workspace\my_prog\chan\F_BB_L.ipt"

 

Dim pDoc as PartDocument = ThisApplication.Documents.Open(fname,False)

pDoc  = ThisApplication.Documents.Open(fname)

 

' these are just attempts to find a syntax that works

' i need the method to change the parameter

 

 'param = pDoc.PartComponentDefinition.Parameter.Param("TKNS")

 'pdoc.parameter.Param("TKNS") = 8

 

pdoc.Save

pdoc.Close

 

*Expert Elite*
jdkriek
Posts: 528
Registered: ‎03-29-2007
Message 2 of 5 (272 Views)

Re: Ilogic Change Parameter in any Part that is not a component

10-01-2013 08:37 PM in reply to: art_turner

Here you go:

 

Dim fName As String = "C:\Workspace\my_prog\chan\F_BB_L.ipt"
Dim pDoc as PartDocument = ThisApplication.Documents.Open(fName, False)
pDoc.ComponentDefinition.Parameters.Item("TKNS2").Value = 8
pDoc.Update
pDoc.Save
pDoc.Close 
Jonathan D. Kriek

Autodesk Inventor Certified Expert
Microsoft Certified Application Developer
_____________________________________________________
Did I help you? Please choose Accept as Solution or Kudos below
Distinguished Contributor
art_turner
Posts: 213
Registered: ‎04-01-2008
Message 3 of 5 (258 Views)

Re: Ilogic Change Parameter in any Part that is not a component

10-02-2013 06:22 AM in reply to: jdkriek

thanks!

 

but,

 

gives result in cm,

the parameter is in inches.

 

8 / 0.39370 gives a result in inches, with errors in the 5th place,

 

what is the standard way to input 8"?

 

thanks again.

 

 

 

 

Mentor
MegaJerk
Posts: 265
Registered: ‎01-26-2011
Message 4 of 5 (239 Views)

Re: Ilogic Change Parameter in any Part that is not a component

10-03-2013 04:44 AM in reply to: art_turner
Perhaps multiplying it would fix the problem

pDoc.ComponentDefinition.Parameters.Item("TKNS2").​Value = (8*2.54)
--------------------------------------------------------------------------------------

If my solution seems to remedy your problem, please press the Accept Solution button, -
as it increases my power levels and will eventually help to elevate me towards outer space.

Check out my iLogic injection tool here : http://goo.gl/ce1Qg
--------------------------------------------------------------------------------------
Distinguished Contributor
art_turner
Posts: 213
Registered: ‎04-01-2008
Message 5 of 5 (220 Views)

Re: Ilogic Change Parameter in any Part that is not a component

10-03-2013 06:50 PM in reply to: MegaJerk

here it is

 

pDoc.ComponentDefinition.Parameters.Item("TKNS").Expression = "8 in"

 

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube