Michael, The problem in your macro is that you are not extracting the text from the user command element. The variable you art using, #Prof, only contains the element number.
IF( TYP(#Prof)=4, and STREQUAL(STRSUB(#Prof,1,strlen(#Prof)),@NOSTOP ) )
The attached sample macro I previously posted that will extract the text
from user commands and text elements. To use, enter the element number of
the user command or text element when prompted.
The macro will then group the identified element and do a "File - Print -
Data - Active Group - (to) File" creating an ASCII data file named
"TempFile.dat" containing the element data for just that one element. The
macro will then read in the data file and search for the word "Text" and
assigns the characters that follow to the string variable #UserText.
The PROMPT[] can be removed and another method can be used to identify the
element number. The macro can be automated and run from within your macro
using the MAC_EXE[] command. In the following example you may need to change
the path of the macro to match the location you run from.
// check if element is a user element
IF(TYP(#Prof)=4)
// extract user text
#ElNum=#Prof
MAC_EXE[FN="C:\Sm9\Shared\Sysmcl\Get User Text.mcl"]
#TestString=STRTMP("#DOFF=1,#TOOL=1")
// compare user text
IF(STREQUAL(#UserText,@NOSTOP)=1)
// replace user text
MOD_UEVENT[EL=#ElNum, XS2=ENX(#ElNum), YS2=ENY(#ElNum),
TX="@STOP", LV=0]
ENDIF
ENDIF
==================================================
Fred Lauzus, CAM Programming Coordinator
High Steel Structures, Incorporated
mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
http://www.highsteel.com <http://www.highsteel.com/>
==================================================
-----Original Message-----
From: Michael Senack [mailto:[EMAIL PROTECTED]
Sent: Monday, June 02, 2003 9:06 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: [mfg-smartcam] Macro IF test help
I'm in need of some help for an IF statement in a macro.
What I'm trying to do with the IF is say...
IF the current element, lets say for example E10, is
a TYP(4) User Element
AND
it is a string that is EQUAL to @NOSTOP
then MODIFY it to @STOP
and ENDIF it.
This is the IF line from the macro that is not passing go...
IF( TYP(#Prof)=4, and STREQUAL(STRSUB(#Prof,1,strlen(#Prof)),@NOSTOP ) )
Below is the rest of the macro
//PAUSE[TX="The so far so good macro pause!", LR=10, LC=5, SR=2, SC=40,
PT=1]
VAR_REMOVE_ALL[]
GRAPHICS_Off[]
MASK[LY="*", SH=0]// hide all layers
MASK[TL="*", SH=1]// show all tools
SELECT_ALL[]// select all tool(s) using ++ icon
MASK[LY="*", SH=1]// show all layers
ELMT_SEQ[BA=1, EL="totel()", ME=0]// Set sequence at end of database
// Move selected elements to end of database in the order they were picked
SEQ_MOVE[SC=1]
#Start=GRP(1)// Get first element in group
#No_Elmt=GRP(0)// Get number of elements in group
#End=totel()// Get last element in database
NEW_GRP[]
// put the tool elements into an array
#Count=1
STRING:#Name
INTEGER:#Count
INTEGER:#Next
#Count=1
WHILE(#Start<=#End)
//Name element
NAME_ELMT[EL=#Start, EN=STRTMP("E%Count") ]
#Start=#Start+1
#Count=#Count+1
ENDW
#Count=1 // reset counter
STRING:#Prof // this is the name for E1, E2, E3 etc
WHILE(#Count<=#No_Elmt)
#Prof=STRTMP("E%Count")
IF( TYP(#Prof)=4, and STREQUAL(STRSUB(#Prof,1,strlen(#Prof)),@NOSTOP ) )
<----------------------- help with this line
ELMT_SEQ[BA=1, EL=STRTMP("E%Count"), ME=1]
MOD_UEVENT[EL=STRTMP("E%Count"), XS2=ENX(SEQEL()),
YS2=ENY(SEQEL()), TX="@STOP", LV=0]
ENDIF
#Start=#Start+1
#Count=#Count+1
ENDW
GRAPHICS_On[]
Any help is as usual greatly appreciated.
Regards,
Michael Senack
Get User Text.mcl
Description: Binary data
