PowerMill Forum
Welcome to Autodesk’s PowerMill Forums. Share your knowledge, ask questions, and explore popular PowerMill topics.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[macro]Function library file

Message 1 of 3
273 Views, 2 Replies

[macro]Function library file

Hello PowerMill Community,

I'm currently working on improving the efficiency of my workflow by centralizing all my functions into a few library files. The goal is to be able to call these functions as needed across various macros I’m developing.

Issue Encountered: I load the library file at the start of each macro by using an include statement, but I’m encountering an issue where the main function of the library file enters a loop, repeating indefinitely no matter what I code inside the main function.

Objective: My aim is to have a centralized library of functions that I can easily call from, which would significantly streamline the process of developing and maintaining macros.

Question: Is there a workaround or a method within PowerMill that allows for the effective use of function libraries without the main function looping? Any guidance or tips on how to implement this would be greatly appreciated as it would simplify my new workflow system.

Thank you in advance for your help!

Message 2 of 3
in reply to: dan_mickle

I dont think the library should contain a main method


the .inc file(Library)

function DoSomething(entity $tp) {

function DoSomeOtherThings(string $input) {


the macro

function Main() {
	foreach $tp in folder('toolpath') {
		call DoSomething($tp)
Message 3 of 3
in reply to: icse

If I try to call a file with functions and no main function, it errors out. 

Edit: Nevermind, I'm dumb. The file that's calling the function needs to have the main function, the function library doesn't need to have a main function

I structured it like this and it worked.

include testFunctionLibrary
function main() {
message info "test"
call resetBlockForm()


Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators

Autodesk Design & Make Report