What Is an AutoLISP Routine? And Why?
A practical English–Khmer guide to understanding AutoLISP routines, how they work, and why they are useful for AutoCAD, Quantity Takeoff (QTO), and Bills of Quantities (BOQ).
What Is an AutoLISP Routine?
AutoLISP Routine គឺជាកម្មវិធី ឬសំណុំកូដ (Program / Set of Instructions) ដែលសរសេរដោយភាសា AutoLISP សម្រាប់បញ្ជាឱ្យ AutoCAD អនុវត្តការងារជាក់លាក់ ដោយស្វ័យប្រវត្តិ (Automation) ឬតាម Command ដែលអ្នកប្រើបញ្ចូល។
An AutoLISP Routine is a custom program written in the AutoLISP programming language to automate tasks, extend AutoCAD functionality, and improve drawing productivity.
និយមន័យខ្លី៖
How Does an AutoLISP Routine Work?
APPLOAD or another supported loading method.TOTALAREA (if defined by the routine).Why Do We Use AutoLISP Routines?
| Purpose | Explanation |
|---|---|
| 1. Automation | ធ្វើការងារដដែលៗដោយស្វ័យប្រវត្តិ |
| 2. Save Time | កាត់បន្ថយពេលវេលាអនុវត្តការងារ |
| 3. Improve Accuracy | កាត់បន្ថយកំហុសដោយដៃ តាមរយៈការគណនាដែលមានការត្រួតពិនិត្យ |
| 4. Customization | បង្កើត Command ឱ្យសមស្របនឹងតម្រូវការផ្ទាល់ខ្លួន |
| 5. Standardization | ធ្វើឱ្យដំណើរការ និងលទ្ធផលមានស្តង់ដារដូចគ្នា |
| 6. Productivity | បង្កើនបរិមាណការងារដែលអាចបញ្ចប់បាន |
| 7. Data Extraction | ទាញយកទិន្នន័យពី Drawing សម្រាប់ QTO / BOQ |
| 8. Integration | រៀបចំ ឬនាំចេញទិន្នន័យទៅ CSV / Excel តាមរយៈវិធីសាស្ត្រដែលបានសរសេរកូដ |
Practical Example — Construction QTO & BOQ
ឧទាហរណ៍ ក្នុងការងារវាស់បរិមាណ (Quantity Takeoff)៖
Without AutoLISP
Select Objects → Measure → Calculate → Record in Excel
Repeated manual stepsWith AutoLISP
Run Command → Select Objects → Calculate → Generate Table
Automated workflowឧទាហរណ៍ AutoLISP Routine អាចជួយការងារសំណង់ដូចជា៖
| AutoLISP Routine | Main Function |
|---|---|
| TotalLengthArea | Calculate Length (m) and Area (m²) |
| TotalVolume | Calculate Volume (m³) using defined geometry or input rules |
| SlabStairRebar | Rebar Quantity Takeoff (kg) |
| ColumnBeamRebar | Column and Beam Reinforcement QTO |
| Pipecut | Optimize stock cutting and waste |
| Export QTO | Generate tables and export quantities |
Example of a Simple AutoLISP Routine
នេះជាឧទាហរណ៍កូដសាមញ្ញដែលបង្កើត Custom Command ឈ្មោះ HELLO។
(defun c:HELLO ()
(princ "\nHello! Welcome to AutoCAD AutoLISP.")
(princ)
)នៅពេល Load File នេះទៅក្នុង AutoCAD រួច វាយ៖
Command: HELLO
Output: Hello! Welcome to AutoCAD AutoLISP.
នេះបង្ហាញថា AutoLISP អាចបង្កើត Command ផ្ទាល់ខ្លួន បាន។
AutoLISP vs. AutoLISP Routine vs. .LSP File
| Term | Meaning |
|---|---|
| AutoLISP | Programming language |
| AutoLISP Routine | Function or program written in AutoLISP |
| .LSP File | File containing AutoLISP source code |
| APPLOAD | Command for loading program files into AutoCAD |
| Custom Command | User-defined command exposed by a routine |
| Automation Tool | Tool that automates work, possibly using AutoLISP |
When Should You Use AutoLISP?
វាស័ក្តិសមជាពិសេសនៅពេល៖
- អ្នកធ្វើការងារដដែលៗច្រើនដង (Repetitive Tasks)។
- អ្នកត្រូវការគណនាបរិមាណពី AutoCAD Drawing។
- អ្នកចង់បង្កើត Table ដោយស្វ័យប្រវត្តិ។
- អ្នកត្រូវការ Standardize Drawing Layers និងការគណនា QTO។
- អ្នកចង់ភ្ជាប់ដំណើរការវាស់បរិមាណពី CAD ទៅ BOQ។
AutoLISP is the programming language. An AutoLISP Routine is the program you build using that language. Automation is one of its main purposes.
សម្រាប់ការងារ Civil Engineering, QTO និង BOQ អត្ថប្រយោជន៍សំខាន់មិនមែនគ្រាន់តែធ្វើការងារបានលឿនទេ ប៉ុន្តែគឺធ្វើឱ្យការងារ លឿនជាងមុន មានស្តង់ដារ អាចត្រួតពិនិត្យបាន និងអាចធ្វើឡើងវិញបាន (Repeatable)។