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
Solved! Go to Solution.
Solved by jdkriek. Go to 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
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.
Can't find what you're looking for? Ask the community or share your knowledge.