Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
Hello Community,
I have a problem, I don´t know how can I make and compile macros with Creo elements/Direct 18.1. If someone have manuals or could tell me how make it I would be very gratefull
Thank you
Solved! Go to Solution.
Hi Ruben,
Let's say you have some macro's in a file "C:\temp\mymacros.m" and you want to store/compile/secure them into a binary, not-readable file, you can do the following:
Warning: after these actions you will need to restart your Drafting session.
DELETE_MACRO ALL {Remove all macro's from your memory in your Drafting session}
INPUT "C:\temp\mymacros.m" {Load your macro's into memory}
SECURE_MACRO ALL {Secure your macros from reading}
STORE_MACRO ALL "C:\temp\mymacros.bin"
Now you can load your stored macros with LOAD_MACRO "C:\temp\mymacros.bin"
If you omit the SECURE_MACRO ALL, the macro will be compiled, but when loaded into your Drafting session, you will still be able to do an EDIT_MACRO and see the contents of a macro.
Best regards,
Wim
Please see the following link for more information on compiling
CoCreate Modeling FAQ: Lisp compiler
Although this web page is not updated for some time, it includes some basic and important information
Hello,
If it is for Drafting, writing macro is very simple: see in C:\Program Files\PTC\Creo Elements\Direct Drafting 19.0\Help\project\WEB-INF\volume, unzip DirectDrafting_xx,
and look at DirectDrafting_PDF\writemac.pdf.
It is not necessary to compile macros as nowadays, the pc are fast. More, compiled macros may not be compatible with next versions of Drafting.
See some examples on my blog Gerard's Blogue
Thank you, I didn´t know nothing about that manual. I can make macros now. Thank you again
Hi Ruben,
Let's say you have some macro's in a file "C:\temp\mymacros.m" and you want to store/compile/secure them into a binary, not-readable file, you can do the following:
Warning: after these actions you will need to restart your Drafting session.
DELETE_MACRO ALL {Remove all macro's from your memory in your Drafting session}
INPUT "C:\temp\mymacros.m" {Load your macro's into memory}
SECURE_MACRO ALL {Secure your macros from reading}
STORE_MACRO ALL "C:\temp\mymacros.bin"
Now you can load your stored macros with LOAD_MACRO "C:\temp\mymacros.bin"
If you omit the SECURE_MACRO ALL, the macro will be compiled, but when loaded into your Drafting session, you will still be able to do an EDIT_MACRO and see the contents of a macro.
Best regards,
Wim
Thank you so much. I´ve got it.
Don't forget to keep the "unsecured Macros" (=your source code) in a safe location.
There is no (official) way to revert unsecured macros back to readable source code.
Concerning "compatibility":
A secured Macro is not more or less compatible than the unsecured source code.
If a new version of CAD (Drafting, Annotation) introduces a change that impacts your Macro,
you have to change/adopt it (regardless if unsecured or secured).
Hope this helps.
Regards,
Max