@stefan.godfroid wrote:
It works great.
Now i have another question.
I have a custom parameter "TEKENINGCODE".
When the "TEKENINGCODE"= K. Then we have to split the filename in to 2 pieces. Everything before "_" must be filled in the custom parameter "FABRIKANT". And every thing after "_" must be filled in into the parameter "Part number".
And in other cases, then the parameters must be filled like the original I-logic code as mentioned above.
Can it be done?
Is this what you are asking about?
''define your strings
Dim FileName, PartNumber, Description, NR, oPOS, POS, FABRIKANT As String
'If TEKENINGCODE is K then do the following..
If iProperties.Value("Custom", "TEKENINGCODE") = "K" Then
'get the filename to start it all
FileName = ThisDoc.FileName(False)
'assign all our variables a value
'select the first 9 digits starting from the LEFT of the filename and set the partnumber variable to that
PartNumber = Left(FileName, 9)
'select the first 4 digits starting from the RIGHT of the filename and set the description variable to that
FABRIKANT = Right(FileName, 4)
'set the custom POS iproperty to teh POS variable we just created
iProperties.Value("Custom", "FABRIKANT") = FABRIKANT
'If TEKENINGCODE is not K then do the following..
Else
'Split xxxx-yy-z_name
'into the following
'part Number: xxxx-yy-z
'description:name
'Custom NR:xxxx
'Custom POS:yy
'get the filename to start it all
FileName = ThisDoc.FileName(False)
'assign all our variables a value
'select the first 9 digits starting from the LEFT of the filename and set the partnumber variable to that
PartNumber = Left(FileName, 9)
'select the first 4 digits starting from the RIGHT of the filename and set the description variable to that
Description = Right(FileName, 4)
'select the first 4 digits starting from the LEFT of the filename and set the NR variable to that
NR = Left(FileName, 4)
'select the first 4 digits starting from the RIGHT of the part number and set the oPOS variable to that.. doing this to get rid of the z
oPOS = Right(PartNumber, 4)
'select the first 2 digits starting from the LEFT of the oPOS variable and set the POS variable to that
POS = Left(oPOS, 2)
'now lets set all of our iproperties
'set the part number iproperty to the partnumber variable we just created
iProperties.Value("Project", "Part Number") = PartNumber
'set the description iproperty to the description variable we just created
iProperties.Value("Project", "Description") = Description
'set the custom NR iproperty to the NR variable we just created
iProperties.Value("Custom", "NR") = NR
'set the custom POS iproperty to teh POS variable we just created
iProperties.Value("Custom", "POS") = POS
End If
-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570
Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269