127 Sets Processing 4000mm 127 Sets High-Precision CNC Lathes
15 Years of Experience

CNC Knowledge: Who said macros are useless? It’s because you can’t make it up!

Many CNC technicians these days don’t understand macro programs. They believe that with automatic programming software, there is no need to learn macro programs. In fact, the function of macro programs is very powerful. For example, when writing some batch and repeat programs, using macro programs only requires changing a few data. There is no […]

cnc knowledge: who said macros are useless? it's because you

Many CNC technicians these days don’t understand macro programs. They believe that with automatic programming software, there is no need to learn macro programs. In fact, the function of macro programs is very powerful. For example, when writing some batch and repeat programs, using macro programs only requires changing a few data. There is no need to carry out a large number of repeated programming, which can be greatly simplified. operations and significantly improve work efficiency.

Macro programs can use variables to perform arithmetic operations, logical operations, and mixed function operations, and also provide loop instructions, branch instructions, and subroutine call instructions.

Generally speaking: macro programs are suitable for programming a series of parts with the same graphics but of different sizes; suitable for programming a series of parts with the same process path but different position parameters; suitable for programming curves without interpolation; instructions such as parabolas, ellipses and hyperbolas.

1

Representation and use of variables

1. Variable representation

#I(I=1,2,3,…)or#[<式子>]

Example: #5, #109, #501, #[#1+#2-12]

2. Using variables

1. Specify the variable number or formula after the address word

Format: #I

The “I” here represents the variable number

Example: F#103, if #103=15, it is F15

Z-#110, assuming #110=250 is Z-250

X[#24+#18*COS[#1]]

2. Variable number can be replaced by a variable

example:#[#30]assuming #30=3, it’s #3

3. Variables cannot use addresses O, N, I

Example: Authorized according to the following method

O#1;

I#2 6.00×100.0;

N#3 Z200.0;

4. The variable corresponding to the variable number has a specific value range for each address.

Example: When #30=1100, M#30 is not allowed

5. #0 is an empty variable. Variables without defined variable values ​​are also empty variables.

6. Definition of the variable value:

The decimal point can be omitted when defining the program, for example: #123=149


2

Variable type

1. Local variables #1~#33

A variable is used locally in a macro program and the results of its operation cannot be used in other programs.

Example: A macro program A macro program B

… …

#10=20 X#10 does not mean X20

… …

Cleared after power off, and the variable value is entered when the macro program is called.

2. Public variables #100~#199, #500~#999

Variables common to each user macro program have the same operation results when called by any program.

Example: When #10 is replaced by #100 in the example above, the

X#100 means X20

#100~#149 Clear after power off

#500~#531 variables retained (not lost after power failure)

3. System variables

Fixed-use variables whose values ​​depend on the state of the system

Example: value #2001 is the compensation value of the X axis of tool #1

The value #5221 is the original offset value of the G54 part on the X axis

A decimal point must be entered when typing. When the decimal point is omitted, the unit is μm.


3

Instructions for use

The right side of an operation expression can be a constant, variable, function, or expression.

In the formula, #j, #k can also be constants

The right side of the formula is the number of variables and the operation formula

1. Definition

#I=#j

2. Arithmetic operations

#I=#j+#k

#I=#j-#k

#I=#j*#k

#I=#j/#k

3. Logical operations

#I=#JOK#k

#I=#JXOK#k

#I=#JAND#k

4. Function

1697180846458234.jpg

#I=SIN[#j] sinus

#I=COS[#j] cosine

#I=TAN[#j] Tangent

#I=ATAN[#j] arctangent

#I=SQRT[#j]square root

#I=ABS[#j]absolute value

#I=ROUND[#j]Rounded

#I=FIX[#j]Charging Adjustment

#I=FUP[#j]Round down

#I=BIN[#j]BCD → BIN (binary)

#I=BCN[#j]BIN → BCD

1) The unit of angle is degree

Example: 90 degrees 30 divided into 90.5 degrees

2) The two side lengths after the ATAN function must be separated by “/”

Example: #1=ATAN[1]/[-1]time, n°1 for 35.0

3) ROUND is used for addresses in statements and is rounded based on the minimum configuration unit of each address.

Example: Suppose #1=1.2345, #2=2.3456, the setting unit is 1 μm

G91 X-#1;X-1,235

X-#2 F300;X-2.346

X[#1+#2];X3.580

has not returned to its original place, it must be replaced by

X[ROUND[#1]+ROUND[#2]];

4) If the absolute value after rounding is greater than the original value, it is rounded up, otherwise it is rounded down.

Example: Suppose #1=1.2, #2=-1.2

If #3=FUP[#1]when, then #3=2.0

if #3 = FIX[#1]when, then #3=1.0

If #3=FUP[#2]when, then #3=-2.0

if #3 = FIX[#2]when, then #3=-1.0

5) When ordering a function, you can only write the first two letters

Example: ROUND → RO

CORRECT → FI

6) Priority

Function → Multiplication and Division (*, 1, AND) → Addition and Subtraction (+, –, OR, XOR)

Example: #1=#2+#3*NAS[#4];

7) Parentheses are square brackets, up to 5 times. Parentheses are used for comment statements.

Example: #1=NAS[[[#2+#3]*#4+#5]*#6](3 layers)


4

Plug and loop instructions

1. Unconditional transfer

Format: GOTO n;

Unconditional transfer to program segment n

n: program segment number (1-99999)

n can also be replaced by variables or expressions

GOTO10;

GO TO #10;

2. Conditional transfer

IF [<条件表达式>] GO TO n;

If the is satisfied, the next operation will be transferred to the program segment with program segment number n.

If you are not satisfied, run the next program segment.

IF [<条件表达式>] SO … ;

If is satisfied, the macro program statement after THEN is executed and only one instruction is executed.

IF[#1EQ #2] THEN #3=0;

Conditional expression:

1697180896472742.png

#j and #k can also be replaced by

Example: IF[#1 GT 10]GO TO 100;

N100 G00 G91 X10;

Example: Find the sum from 1 to 10

O9500;

#1=0

#2=1

N1 IF[#2 GT10]GO TO 2

#1=#1+#2;

#2=#2+1;

GO TO 1

N2M30

3. Loop

Format: DURING[<条件式>]DO m;(m=1,2,3)

END

1. When the conditions are met, run DOm until ENDm, then start from the program segment of DOm

If dissatisfied, run the following program segment ENDm

2. Omit the WHILE statement and just DOm…ENDm will form an infinite loop from DOm to ENDm.

3. Nested

4. When EQ NE, empty is different from “0”

Otherwise, empty equals “0”

Example: Find the sum from 1 to 10

O0001;

#1=0;

#2=1;

WHILE[#2LE10]DO1;

#1=#1+#2;

#2=#2+#1;

END1;

M30;

Daguang focuses on providing solutions such as precision CNC machining services (3-axis, 4-axis, 5-axis machining), CNC milling, 3D printing and rapid prototyping services.

CNC Experts

Picture of JinShui Chen

JinShui Chen

Rapid Prototyping & Rapid Manufacturing Expert

Specialize in CNC machining, 3D printing, urethane casting, rapid tooling, injection molding, metal casting, sheet metal and extrusion

CNC Recent Posts

CNC News

Welcome to GreatLight Metal,Maximum Processing Size 4,000 mm

Precision Machining CNC Quote Online

Loading file

Upload Click here to upload or drag and drop your model to the canvas.

The model is too large and has been resized to fit in the printer's build tray. [Hide]

The model is too large to fit in the printer's build tray. [Hide]

The model is too large, a fitting printer is selected. [Hide]

The model is too small and has been upscaled. [Hide]

Warning: The selected printer can not print in full color [Hide]

Warning: obj models with multiple meshes are not yet supported [Hide]

Warning: Unsupported DXF entity  [Hide]

Warning: could not arrange models [Hide]

[Hide]


File Unit:      
Scale:
%
L × W × H:
X: × Y: × Z:  cm 
Rotation:
X: ° Y: °  
⚡ Instant Quote for Precision Manufacturing

Submit your design files (STEP/IGES/DWG) and receive a competitive quote within 1 hour, backed by ISO 9001-certified quality assurance.

📋 How It Works

  1. Upload & SpecifyShare your 3D model and select materials (Aluminum/Stainless Steel/Titanium/PEEK), tolerances (±0.002mm), and surface treatments.

  2. AI-Powered AnalysisOur system calculates optimal machining strategy and cost based on 10+ years of automotive/aerospace data.

  3. Review & ConfirmGet a detailed breakdown including:
    - Volume pricing tiers (1-10,000+ units)
    - Lead time (3-7 days standard)
    - DFM feedback for cost optimization

Unit Price: 

Loading price
5 Axis CNC Machining Equipment
4 Axis CNC Machining Equipment
3 Axis CNC Machining Equipment
CNC Milling & Turning Equipment
Prototype and Short-Run Injection Moldings Exact plastic material as final design
Volume Metal Die Casting Services - Precision Cast Parts
Bridge the Gap From Prototype to Production – Global delivery in 10 days or less
Custom high-precision sheet metal prototypes and parts, as fast as 5 days.
Custom Online 3D Printing Services
Custom Online 3D Printing Services
Custom Online 3D Printing Services
Design Best Processing Method According To 3D Drawings
Alloys Aluminum 6061, 6061-T6 Aluminum 2024 Aluminum 5052 Aluminum 5083 Aluminum 6063 Aluminum 6082 Aluminum 7075, 7075-T6 Aluminum ADC12 (A380)
Alloys Brass C27400 Brass C28000 Brass C36000
Alloys Stainless Steel SUS201 Stainless Steel SUS303 Stainless Steel SUS 304 Stainless Steel SUS316 Stainless Steel SUS316L Stainless Steel SUS420 Stainless Steel SUS430 Stainless Steel SUS431 Stainless Steel SUS440C Stainless Steel SUS630/17-4PH Stainless Steel AISI 304
Inconel718
Carbon Fiber
Tool Steel
Mold Steel
Alloys Titanium Alloy TA1 Titanium Alloy TA2 Titanium Alloy TC4/Ti-6Al 4V
Alloys Steel 1018, 1020, 1025, 1045, 1215, 4130, 4140, 4340, 5140, A36 Die steel Alloy steel Chisel tool steel Spring steel High speed steel Cold rolled steel Bearing steel SPCC
Alloys Copper C101(T2) Copper C103(T1) Copper C103(TU2) Copper C110(TU0) Beryllium Copper
Alloys Magnesium Alloy AZ31B Magnesium Alloy AZ91D
Low Carbon Steel
Alloys Magnesium Alloy AZ31B Magnesium Alloy AZ91D
ABS Beige(Natural) ABS Black ABS Black Antistatic ABS Milky White ABS+PC Black ABS+PC White
PC Black PC Transparent PC White PC Yellowish White PC+GF30 Black
PMMA Black PMMA Transparent PMMA White
PA(Nylon) Blue PA6 (Nylon)+GF15 Black PA6 (Nylon)+GF30 Black PA66 (Nylon) Beige(Natural) PA66 (Nylon) Black
PE Black PE White
PEEK Beige(Natural) PEEK Black
PP Black PP White PP+GF30 Black
HDPE Black HDPE White
HIPS Board White
LDPE White
This is a finish of applying powdered paint to the components and then baking it in an oven, which results in a stronger, more wear- and corrosion-resistant layer that is more durable than traditional painting methods.
No coating required, product’s natural color!
This is a finish of applying powdered paint to the components and then baking it in an oven, which results in a stronger, more wear- and corrosion-resistant layer that is more durable than traditional painting methods.
This finishing option with the shortest turnaround time. Parts have visible tool marks and potentially sharp edges and burrs, which can be removed upon request.
Sand blasting uses pressurized sand or other media to clean and texture the surface, creating a uniform, matte finish.
Polishing is the process of creating a smooth and shiny surface by rubbing it or by applying a chemical treatmen
A brushed finish creates a unidirectional satin texture, reducing the visibility of marks and scratches on the surface.
Anodizing increases corrosion resistance and wear properties, while allowing for color dyeing, ideal for aluminum parts.
Black oxide is a conversion coating that is used on steels to improve corrosion resistance and minimize light reflection.
Electroplating bonds a thin metal layer onto parts, improving wear resistance, corrosion resistance, and surface conductivity.
This is a finish of applying powdered paint to the components and then baking it in an oven, which results in a stronger, more wear- and corrosion-resistant layer that is more durable than traditional painting methods.
This is a finish of applying powdered paint to the components and then baking it in an oven, which results in a stronger, more wear- and corrosion-resistant layer that is more durable than traditional painting methods.
Please provide additional text description for other surface treatment requirements!
Material
Material
  • CNC Metals
    • Aluminum
    • Brass
    • Stainless steel
    • Inconel718
    • Carbon Fiber
    • Tool Steel
    • Mold Steel
    • Titanium
    • Alloy Steel
    • Copper
    • Bronze
    • Low Carbon Steel
    • Magnesium
  • CNC Plastics
    • ABS
    • PC
    • PMMA (Acrylic)
    • PA (Nylon)
    • PE
    • PEEK
    • PP
    • HDPE
    • HIPS
    • LDPE
Printer
Printer
  • CNC Metals
    • 5 Axis CNC Machining
    • 4 Axis CNC Machining
    • 3 Axis CNC Machining
    • CNC Milling & Turning
    • Rapid Tooling
    • Metal Die Casting
    • Vacuum Casting
    • Sheet Metal Fabrication
    • SLA 3D Printing
    • SLS 3D Printing
    • SLM 3D Printing
  • Rapid Prototyping
    • Design Best Processing Method According To 3D Drawings
Post-processing
Post-processing
  • As Machined(Product’s natural color)
  • Sand Blasting
  • Polishing
  • Brushed Finish
  • Anodizing
  • Black Oxide
  • Electroplating
  • Paint Coating
  • Powder Coating
  • Other surface treatment requirements
Finalize
The world's first CNC machining center that dares to provide free samples!

Free for first product valued at less than $200. (Background check required)

precision machining cnc quote online

15 Years CNC Machining Services

When you’re ready to start your next project, simply upload your 3D CAD design files, and our engineers will get back to you with a quote as soon as possible.
Scroll to Top

ISO 9001 Certificate

ISO 9001 is defined as the internationally recognized standard for Quality Management Systems (QMS). It is by far the most mature quality framework in the world. More than 1 million certificates were issued to organizations in 178 countries. ISO 9001 sets standards not only for the quality management system, but also for the overall management system. It helps organizations achieve success by improving customer satisfaction, employee motivation, and continuous improvement. * The ISO certificate is issued in the name of FS.com LIMITED and applied to all the products sold on FS website.

greatlight metal iso 9001 certification successfully renewed
GB T 19001-2016 IS09001-2015
✅ iso 9001:2015
greatlight metal iso 9001 certification successfully renewed zh

IATF 16949 certificate

IATF 16949 is an internationally recognized Quality Management System (QMS) standard specifically for the automotive industry and engine hardware parts production quality management system certification. It is based on ISO 9001 and adds specific requirements related to the production and service of automotive and engine hardware parts. Its goal is to improve quality, streamline processes, and reduce variation and waste in the automotive and engine hardware parts supply chain.

automotive industry quality management system certification 01
Certification of Production Quality Management System for Engine Hardware Parts Engine Hardware Associated Parts
automotive industry quality management system certification 00
发动机五金零配件的生产质量管理体系认证

ISO 27001 certificate

ISO/IEC 27001 is an international standard for managing and processing information security. This standard is jointly developed by the International Organization for Standardization (ISO) and the International Electrotechnical Commission (IEC). It sets out requirements for establishing, implementing, maintaining, and continually improving an information security management system (ISMS). Ensuring the confidentiality, integrity, and availability of organizational information assets, obtaining an ISO 27001 certificate means that the enterprise has passed the audit conducted by a certification body, proving that its information security management system has met the requirements of the international standard.

greatlight metal technology co., ltd has obtained multiple certifications (1)
greatlight metal technology co., ltd has obtained multiple certifications (2)

ISO 13485 certificate

ISO 13485 is an internationally recognized standard for Quality Management Systems (QMS) specifically tailored for the medical device industry. It outlines the requirements for organizations involved in the design, development, production, installation, and servicing of medical devices, ensuring they consistently meet regulatory requirements and customer needs. Essentially, it's a framework for medical device companies to build and maintain robust QMS processes, ultimately enhancing patient safety and device quality.

greatlight metal technology co., ltd has obtained multiple certifications (3)
greatlight metal technology co., ltd has obtained multiple certifications (4)

Get The Best Price

Send drawings and detailed requirements via Email:[email protected]
Or Fill Out The Contact Form Below:

All uploads are secure and confidential.