To the best of my knowledge you cannot launch a macro from your code generator.
You can pass values from the macro environment to the code generator, but if your intent is to use these coordinates in the code generator there is a better method. There are some macro functions that are accessible from within the template file of the code generator. The following macro commands and more are explained on pages 82-86 of the SmartCAM Customization Guide. TOTEL() VIS(elnum) STEP(elnum) TYP(elnum) LEN(elnum) ENX(elnum) ENY(elnum) Here is an example of their use in a code generator template file. This routine will loop through the entire database and test one element at a time until it finds the first unmasked hole or point element. The routine then checks if the element has any depth which would make it a hole, not a point. Once found it extracts the X and Y coordinates and assigns them to the variables #V0 and #V1 for output to code. Once the first hole or point has been processed the routine will exit the repeat loop and continue to code. The long form: @START // set element counter to 1 #EVAL(#U0=1) // repeat the following process for the total number of elements #REPEAT(TOTEL())< // check if the current element is masked #IF(VIS(#U0))< // check if the current unmasked element is a step #IF(STEP(#U0)>-1)< // check if the current unmasked step element is a hole or point #IF(TYP(#U0)=1)< // check if the current unmasked step hole or point has a depth #EVAL(#V2=LEN(#U0)) #EVAL(#S2=#V2) #IF(STRLEN(#S2)>0)< // extract X coordinate #EVAL(#V0=ENX(#U0)) // extract Y coordinate #EVAL(#V1=ENY(#U0)) // set counter to maximum to exit repeat loop early #EVAL(#U0=TOTEL()) // end of LEN check > // end of TYP check > // end of STEP check > // end of VIS check > // advance counter to next element #EVAL(#U0=#U0+1) // end of REPEAT loop > #MOV X#V0 Y#V1 The short form: @START #EVAL(#U0=1) #REPEAT(TOTEL())< #IF(VIS(#U0))< #IF(STEP(#U0)>-1)< #IF(TYP(#U0)=1)< #EVAL(#V2=LEN(#U0)) #EVAL(#S2=#V2) #IF(STRLEN(#S2)>0)< #EVAL(#V0=ENX(#U0)) #EVAL(#V1=ENY(#U0)) #EVAL(#U0=TOTEL())>>>> #EVAL(#U0=#U0+1)> #MOV X#V0 Y#V1 ============================================= Fred Lauzus, CAM Programming Coordinator High Steel Structures, Incorporated mailto:[EMAIL PROTECTED] http://www.highsteel.com ============================================= -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 22, 2001 12:18 PM To: 'SmartCam Forum' Subject: RE: [mfg-smartcam] 1st Element that is a hole Fred, I am a novice at using macros so I have a couple of questions. I ran the macro as you wrote it and saw where it put the correct values in the xcoord and ycoord variables. My questions are... 1. Can I execute a macro from within my code generator? 2. How do I use the variables xcoord and ycoord in my code generator? Thanks, Dave "Lauzus, Frederick" <[EMAIL PROTECTED]> on 02/22/2001 09:56:14 AM To: David Vandervort/USA/Praxair@Praxair, 'SmartCam Forum' <[EMAIL PROTECTED]> cc: Subject: RE: [mfg-smartcam] 1st Element that is a hole Try this... // remove any active group NEW_GRP[] // set group/snap filter for hole elements only FILTER[PT=0, HL=1, LN=0, AR=0, PL=0, SP=0, EL=0, HX=0, TX=0, UC=0, SC=0, DC=0, LY=0, ST=0, WP=0] // activate group/snap filter FILTER_USE[ON=1] // group all unmasked elements by filter (holes only) GRP_FILT_ADD[] // check if there are any elements (holes) in the active group IF(GRP(0)>0) // extract end X and Y coordinates of first element in group #XCoord=ENX(GRP(1)) #YCoord=ENY(GRP(1)) ENDIF // remove active group NEW_GRP[] // reset group snap filter for all element types FILTER[PT=1, HL=1, LN=1, AR=1, PL=1, SP=1, EL=1, HX=1, TX=1, UC=1, SC=1, DC=1, LY=0, ST=0, WP=0] // de-activate group snap filter FILTER_USE[ON=0] ============================================= Fred Lauzus, CAM Programming Coordinator High Steel Structures, Incorporated mailto:[EMAIL PROTECTED] http://www.highsteel.com ============================================= -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 22, 2001 9:31 AM To: 'SmartCam Forum' Subject: [mfg-smartcam] 1st Element that is a hole I'm back to working on my C axis code generator which I have working with one exception. I need to extract the XPOS and YPOS from the 1st hole in my Amill file to be used in an equation. I know how to do this if it is the 1st element in the file but not if it isn't. Thanks for the help, Dave ====================================================================== To find out more about this mailing list including how to unsubscribe, send the message "info mfg-smartcam" to [EMAIL PROTECTED] ====================================================================== ====================================================================== To find out more about this mailing list including how to unsubscribe, send the message "info mfg-smartcam" to [EMAIL PROTECTED] ====================================================================== ====================================================================== To find out more about this mailing list including how to unsubscribe, send the message "info mfg-smartcam" to [EMAIL PROTECTED] ======================================================================
