Master Function Script

Master Function Script

barr.jarryd
Advocate Advocate
672 Views
3 Replies
Message 1 of 4

Master Function Script

barr.jarryd
Advocate
Advocate

Hey folks,

 

I was wondering if it's possible to create a "Master Function" macro that just houses all my functions. And also if I can create it, how I would go about calling functions in that master script.

 

Thanks in advance for any help or information on this subject.

0 Likes
673 Views
3 Replies
Replies (3)
Message 2 of 4

ondrej.mikulec
Advocate
Advocate

A master macro file:

INCLUDE macro_function.inc

FUNCTION Main() {

	BOOL $fromCall = 0
	
	CALL Function1( $fromCall)
	
	IF $fromCall {
		MESSAGE INFO "Exists"
	}

}

 The secondary file must have a .inc extension and its folder referenced as Macro Paths. 

FUNCTION Function1 (OUTPUT BOOL $test) {

	$test = $entity_exists("Toolpath","test_name")

}

 

Message 3 of 4

kevin.hammond3WX4X
Advocate
Advocate
Refer to Page 53 of the macro programming guide, ref Common.inc.
I have used common.inc for frequently used functions, which are then called by the macro you are running, using 'Include common.inc' at the head of the macro, this will permit functions in common.inc to be called.

Message 4 of 4

TK.421
Advisor
Advisor

you can keep that file anywhere and name it anything. if you reference the path here, you do not need to add it to the macro path in the options.  this is what i do at the beginning of all my macros. I use vs code for an editor and have a code snippet made for starting macros that prints all that stuff. 

TK421_0-1657021231854.png

 


the numbers never lie
0 Likes