Home   Products   Custom   Document   Download   Partners   Service   Contact
   
 
CAD/CAM Development
Customizing
 
 
Download Software
Download Video
Download PDF
     
Payment
Support
Ordering
   
 
HNC21 macro programming

HNC -21M NC system equips powerful macro function similar with high language.
Consumer can use variable to do arithmetic operation, logical operation and functional hybrid operation. Moreover, macro provides loop statement, branch statement and subprogram calling statement to make program editing of complex components easy, and reduce , even avoid, cockamamie numerical evaluation.

1. macro variables and constant

(1) macro variables
#0¡«#49 current local variable
#50 ¡« #199 global variable
#200 ¡« #249 0 layer local variable
#250 ¡« #299 1 layer local variable
#300 ¡« #349 2 layer local variable
#350 ¡« #399 3 layer local variable
#400 ¡« #449 4 layer local variable
#450 ¡« #499 5 layer local variable
#500 ¡« #549 6 layer local variable
#550 ¡« #599 7 layer local variable
#600 ¡« #699 register of tool length H0 ¡« H99
#700 ¡« #799 register of tool radius D0 ¡« D99
#800 ¡« #899 register of cutting life

(2) constant
PI £º ¦Ð
TRUE £º condition true (T)
FALSE £º condition false (F)


2. operator and expression

(1) arithmetical operator £º + £¬ - £¬ * £¬ /

(2) conditional operator
EQ £¨ = £©£¬ NE £¨ ¡Ù £©£¬ GT £¨£¾£©£¬
GE £¨ ¡Ý £©£¬ LT £¨£¼£©£¬ LE £¨ ¡Ü £©

(3) logical operator
AND £¬ OR £¬ NOT

(4) function
SIN £¬ COS £¬ TAN £¬ ATAN £¬ ATAN2 £¬
ABS £¬ INT £¬ SIGN £¬ SQRT £¬ EXP

(5) expression
Constant s and macro variables linked by operators compose expression.
For example £º 175/SQRT[2] * COS[55 * PI/180 ] £»
#3*6 GT 14 £»

3. assignment statement

Format £º macro variables = constant or expression
Sending values of constant or expression to a macro variable is called assignment .
For example £º #2 = 175/SQRT[2] * COS[55 * PI/180 ] £»
#3 = 124.0 £»

conditional judgment statement IF £¬ ELSE £¬ ENDIF
Format (i) £º IF conditional expression
¡­
ELSE
¡­
ENDIF
Format (ii) £º IF conditional expression
¡­
ENDIF



4. loop statement WHILE £¬ ENDW

Format £º WIIILE conditional expression
¡­
ENDW
Using of conditional judgment statement see also example of macro programming
Using of loop statement see also example of macro programming

5. example



locus£º



program code£º

%0010
#10=10.0
#11=10.0
#12=124.0
#13=124.0
#101=8.0
#102=6.5
#103=6.0
N01 G92 X0.0 Y0.0 Z10.0
#0=0
N06 G00 X[-#12] Y[-#13]
N07 G01 Z[-#10] M03 S600 F200
WHILE #0 LT 3
N[08+#0*6] G01 G42 X[-#12/2] Y[-90/2] F280.0 D[#0+50]
N[09+#0*6] X[0] Y[-90/2]
N[10+#0*6] G03 J[90/2]
N[11+#0*6] G01 X[#12/2] Y[-90/2]
N[12+#0*6] G40 X[#12] Y[-#13]
N[13+#0*6] G00 X[-#12] Y[-#13]
#0=#0+1
ENDW
N100 Z[-#10-#11]
#2=90/SQRT[2]*COS[55*PI/180]
#3=90/SQRT[2]*SIN[55*PI/180]
#4=90*COS[10*PI/180]
#5=90*SIN[10*PI/180]
#0=0
WHILE #0 LT 3
N[101+#0*8]G01 G42 X[-#12/2] Y[-90/2] F280.0 D[#0+50]
N[102+#0*8]X[-#2] Y[-#3]
N[103+#0*8]G91 X[+#4] Y[+#5]
N[104+#0*8]X[-#5] Y[+#4]
N[105+#0*8]X[-#4] Y[-#5]
N[106+#0*8]X[+#5] Y[-#4]
N[107+#0*8] G90 X[#12/2] Y[-90/2]
N[108+#0*8]G00 G40 X[-#12] Y[-#13]
#0=#0+1
ENDW
G00 X0 Y0 M05 M30

 
Copyright @2009 Nanjing Swansoft Technology Company.All rights reserved
Nanjing Swansoft Technology Company
Address: Junlin Guoji Building, 5 Guangzhou Road,Suite A 1306, Nanjing, Jiangsu 210008 CHINA
TEL:(86)025-51862150 FAX(TEL):(86)025-51860015 Mobile:15150565151 E-Mail:sales@swansc.com