Ilogic Change Parameter in any Part that is not a component

Ilogic Change Parameter in any Part that is not a component

Anonymous
Not applicable
805 Views
4 Replies
Message 1 of 5

Ilogic Change Parameter in any Part that is not a component

Anonymous
Not applicable

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

 

0 Likes
Accepted solutions (1)
806 Views
4 Replies
Replies (4)
Message 2 of 5

jdkriek
Advisor
Advisor
Accepted solution

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
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 3 of 5

Anonymous
Not applicable

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.

 

 

 

 

0 Likes
Message 4 of 5

MegaJerk
Collaborator
Collaborator
Perhaps multiplying it would fix the problem

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


If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

GitHub
0 Likes
Message 5 of 5

Anonymous
Not applicable

here it is

 

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

 

 

0 Likes