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

[macro]Function library file

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
dan_mickle
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!

2 REPLIES 2
Message 2 of 3
icse
in reply to: dan_mickle

I dont think the library should contain a main method

 

the .inc file(Library)

function DoSomething(entity $tp) {
	//Code
}

function DoSomeOtherThings(string $input) {
	//Code
}

 

the macro

include myfunctions.inc
function Main() {
	foreach $tp in folder('toolpath') {
		call DoSomething($tp)
	}
}
Message 3 of 3
dan_mickle
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