Hi,
Look at the code bellow, is a CATScript
Sub CATMain()
Dim partDocument1 As PartDocument
Dim part1 As Part
Dim parameters1 As Parameters
Set partDocument1 = CATIA.ActiveDocument
Set part1 = partDocument1.Part
Set parameters1 = part1.Parameters
Set product1 = partDocument1.GetItem(part1.Name)
Set parameters2 = product1.UserRefProperties
'~ ’Create Userproperties
Set strParam1 = parameters2.CreateString("MyUserProperty", "Hello Guys")
part1.update
End Sub
This was an example how user defined properties can be created (only one parameter). As far as I know, when importing a txt file, you will have same result like creating few user defined properties.
So, the idea is to read the text file line by line in macro, get from there the user properties and the values one by one from each line ( for example MyUserProperty2 and "Hello Guys 2" a.s.o.), then write them in strParam2 , strParam3.....
To read from a text file you can do it somehow like (pseudo code):
'~ ' ---------------------------------------
Const ForReading = 1, ForWriting = 2
Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fs

penTextFile("C:\temp\User_Parameter.txt", ForReading)
Do While MyFile.AtEndOfLine=false
ReadLineTextFile = MyFile.ReadLine
'''here you need write your code
Loop
Regards
Fernando