The answer is... Yes. From within your macro you make a call to the
CATIA.SystemServices object. Here is an example of how it is
done.
Language="VBSCRIPT"
Sub CATMain()
Set partDocument1 = CATIA.ActiveDocument
Set part1 = partDocument1.Part
Dim params()
CATIA.SystemService.ExecuteScript"path",
catScriptLibraryTypeDirectory, "Macro2.catvbs", "CATMain",
params
MsgBox "Original Macro resumes"
End Sub
The argument catScriptLibraryTypeDirectory can be a different value
if the macro is stored internally to a CATPart. In that case it
would be catScriptLibraryTypeDocument. A third type would be if the
macro was written in a VBA project. In that case it would be
catScriptLibraryTypeVBAProject.
I've tried the above example and it does work. It executes the
called macro seemlessly without hesitation. The calling macro
starts execution and then executes the called macro. Once the
called macro finishes, the calling macro completes its execution.
So, you could have an if statement in the middle that calls
different macros depending on the tests, continue execution and do
different operations.
Regards,
Bob P.
Author:
Robert M
Petersen