Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
Hello,
I am working on a macro in VBA api with creo 4.0 M140 to update relations in a model.
I managed to have everything work out with the pfcModel.Model.Import inputing the path for a .txt file with the relations I want and the IpfcImportInstructions object created from relation import instruction.
My tests were running well, and then suddenly, the method model.import throws a ToolkitGeneralError that I cannot comprehend.
I've tried stripping my code to just the one action of using the import method, but now I keep getting that error, and I do not see what is going wrong.
Calling another property of the Ipfc model works so it seems to be correctly defined.
Any help will be greatly appreciated !
Here is my test code :
Sub Run_test()
Dim asynconn As New pfcls.CCpfcAsyncConnection
Dim conn As pfcls.IpfcAsyncConnection
Dim session As pfcls.IpfcBaseSession
Dim model As pfcls.IpfcModel
'SESSION INITIALISATION
Set conn = asynconn.Connect("", "", ".", 5) 'start of the creo vb session
Set session = conn.session
Set model = session.currentModel 'definition of the current session model and solid
Dim rel_instructions As New CCpfcRelationImportInstructions 'creation of new import instructions for relations
Dim instr_import As IpfcImportInstructions
Set instr_import = rel_instructions.Create 'definition of the import instructions as relation_import_instruction to use in import method
model.Import "N:\atgm\UNIT\4.7.1\PRE-PROD\scripts\Creo4_config\test_file.txt", instr_import 'importing the new relation file
conn.Disconnect (2)
End Sub
Solved! Go to Solution.
Solved my own issue : it turns out the text string I had written in the input import file was not correctly formatted for creo.
Note for the future :
creo comments are written with /* and not */
creo takes the single quotation mark (eg. ' something ') and not the double one (eg. " something ") : beware of copy pasting from different text editors that can interpret the signs in different ways (use apostrophe sign to be safe)
I hope this can help someone too just in case.
Solved my own issue : it turns out the text string I had written in the input import file was not correctly formatted for creo.
Note for the future :
creo comments are written with /* and not */
creo takes the single quotation mark (eg. ' something ') and not the double one (eg. " something ") : beware of copy pasting from different text editors that can interpret the signs in different ways (use apostrophe sign to be safe)
I hope this can help someone too just in case.