DXF Group Codes Reference Manual for AutoLISP (entget/entmake) & Python (ezdxf)
Complete developer lookup guide for DXF entity group codes (0, 2, 8, 10, 40, 62, 70, 100, 1000) used in AutoLISP entget/entmod and Python ezdxf automation.
1. Engineering Architecture & Core Methodology
Every entity inside a GstarCAD or AutoCAD database is stored as a tagged association list of DXF Group Codes. Whether you are manipulating entities via AutoLISP (entget)/(entmod)/(entmake), C++ GRX resbuf chains, or headless Python ezdxf scripts, mastering these integer group codes gives you direct surgical control over DWG geometry.
2. Step-by-Step Production Workflow & Command Modules
1. Universal Entity Header Group Codes (-1, 0, 5, 8, 6, 62, 370, 420)
Every graphical object shares a common set of property codes: -1 (Entity Name pointer), 0 (Entity Type string such as "LINE", "LWPOLYLINE", "INSERT"), 5 (Hexadecimal persistent Handle), 8 (Layer name), 62 (ACI Color index 1–255; 256 = ByLayer; 0 = ByBlock), and 370 (Lineweight in 1/100th mm).
2. Geometric Coordinate & Scalar Codes (10–18, 40–48, 50–58, 70–78)
Group 10 is always the Primary Point (start point, center, or insertion point), 11 is the Secondary Point (line endpoint or text alignment point), 40 is Radius or Text Height, 41/42/43 are X/Y/Z block scale factors (or LWPOLYLINE bulge at 42), 50 is Rotation angle in radians, and 70 is bit-coded integer flags (e.g., 1 = Closed polyline).
3. Extended Entity Data (XData 1000–1071) & AcDb Subclass Markers (100)
Modern AC1032 entities require (100 . "AcDbEntity") and (100 . "AcDbPolyline") subclass markers during (entmake). Custom ERP/GIS payloads attach under group -3 using codes 1001 (Registered App Name), 1000 (ASCII string), 1040 (Real), and 1070 (16-bit integer).
3. Command, Variable & Standard Reference Matrix
| Command / Parameter | Scope / Target | Engineering Behavior & Best Practice |
|---|---|---|
0 / 5 / 100 |
String / Hex / Subclass | Entity Type (LINE, INSERT), Handle, AcDb Marker — (assoc 0 elist) |
8 / 6 / 62 / 370 |
Layer / Linetype / Color / LW | Layer Name, Linetype, ACI Color (256=ByLayer), Lineweight — (assoc 8 elist) |
10 / 11 / 210 |
3D Point (X Y Z) | Start/Center/Insert Point, Endpoint, Extrusion Normal — (cdr (assoc 10 elist)) |
40 / 41 / 42 / 50 |
Double-Precision Real | Radius/Height, X-Scale, Y-Scale/Bulge, Angle (Radians) — (cdr (assoc 40 elist)) |
1 / 2 / 7 / 70 |
String / Integer Flag | Text String (1), Block/Tag Name (2), Style (7), Bit Flags (70) — (cdr (assoc 1 elist)) |
4. Automation Script & Reference Implementation (AutoLISP Direct (entmake) High-Speed Closed LWPOLYLINE Generator)
; Create a closed rectangular LWPOLYLINE via pure DXF group codes (100x faster than COMMAND)
(defun c:FAST-RECT-DXF ( / p1 p2)
(setq p1 '(0.0 0.0) p2 '(200.0 100.0))
(entmake
(list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(8 . "0") '(62 . 256)
'(100 . "AcDbPolyline") '(90 . 4) '(70 . 1) ; 4 vertices, bit 1 = Closed
(cons 10 p1) (cons 10 (list (car p2) (cadr p1)))
(cons 10 p2) (cons 10 (list (car p1) (cadr p2)))))
(princ "\n[DXF Engine] Closed LWPOLYLINE entmade in <1 ms.")
(princ)
)
5. Production QA Verification & Competency Checklist
- Always supply group 100 subclass markers when calling (entmake) on LWPOLYLINE, MTEXT, or HATCH.
- Remember that DXF Group 50 stores angles in Radians in AutoLISP (entget), whereas DXF ASCII files store degrees.
- Use (subst newpair oldpair elist) followed by (entmod elist) for zero-overhead property updates.
Enterprise AC1032 Database Internals & Cross-Version Diagnostics
In multi-office engineering environments operating across GstarCAD 2027, GstarCAD Mechanical, GstarCAD Architecture, and legacy AutoCAD (2018–2027) seats, mastering DXF Group Codes Reference Manual for AutoLISP (entget/entmake) & Python (ezdxf) requires understanding how the underlying AC1032 DWG binary database serializes entity handles, symbol table records, and Named Object Dictionary (NOD) pointers.
1. DWG Header & Registry Persistence Scope
Variables and object properties fall into three persistence scopes: Drawing-Saved (DXF Header) variables that travel with the .dwg file to subcontractors, Registry-Saved (Profile .arg) settings that persist per Windows workstation user, and Session-Volatile states that reset on every launch unless locked inside acaddoc.lsp. Always verify persistence scope via SYSVDLG before issuing sheets to an ISO 19650 Common Data Environment (CDE).
2. Multi-Core Regeneration & Memory Hygiene
When processing large civil corridors, dense plant P&IDs, or 50-sheet architectural Xref trees, unpurged Registered Application IDs (REGAPP), orphaned DGN stroke dictionaries, and redundant annotation scales degrade spatial index (INDEXCTL = 3) lookup speed. Executing a pre-submittal AUDIT, command-line -PURGE → Regapps, and OVERKILL pass keeps file open times under 2 seconds on GstarCAD's multi-threaded graphics kernel.
3. Hybrid AutoCAD + GstarCAD Team Coexistence
Because GstarCAD reads and writes native AC1032 binary records without intermediate import/export translation, dynamic block grips, associative hatches, XData payloads (DXF groups 1000–1071), Paper Space viewport layer overrides (VPLAYER), and X.509 digital signatures round-trip losslessly between AutoCAD and GstarCAD seats on shared SMB/BIM cloud folders.
Production Field Verification Protocol (ISO 9001 / ISO 19650 Gate)
- Baseline Template Audit: Confirm that the active drawing inherits layer naming, linetype scales (
PSLTSCALE = 1,MSLTSCALE = 1,LTSCALE = 1.0), and dimension styles from the enterprise.dwt/.dwsstandards file viaCHECKSTANDARDS. - Coordinate & Unit Integrity: Run
-DWGUNITSor checkINSUNITS,LUNITS, andMEASUREMENTto guarantee 1:1 metric (`mm`/`m`) or imperial (`in`/`ft`) block and Xref insertion scaling, withOSNAPZ = 1preventing unintended 3D elevation drift. - Submittal Packaging & Mobile Review: Lock all Paper Space viewports (`DisplayLocked = Yes`), bind or relative-path all external references via
ETRANSMIT, and verify final plotted PDF/A lineweights (`ISO full bleed`) alongside DWG FastView mobile cloud markup links.
Related Engineering Guides, Courses & Troubleshooting FAQs
Continue building your CAD engineering mastery with these related GstarCAD Academy technical references:
- [Engineering Guide] Course 27: Automated Limits & Fits (AMPOWERDIM), ISO 286 Hole/Shaft Basis & Tolerance Charts
- [Engineering Guide] Course 31: Multi-Axis Structural Grids, Custom Column Schedules & Foundation Plans
- [Engineering Guide] Course 37: GIS Shapefile (.SHP), GeoJSON & Coordinate System Transformation in GstarCAD
- [Troubleshooting FAQ] How to Create Custom Hatch Patterns (.PAT) and Use SUPERHATCH in GstarCAD
- [Troubleshooting FAQ] How to Export SolidWorks & 3D Sheet Metal Flat Patterns to Clean CNC Laser DXF in GstarCAD
- [Troubleshooting FAQ] How to Fix 'Drawing File Is Currently in Use / Locked' (.DWL & .DWL2) After a Crash
- [Skill Certification] Test Your Mastery on the 850-Question GstarCAD Engineering Certification Engine →
Practice This Workflow in GstarCAD 2027 Professional
Engineered by Suzhou Gstarsoft Co., Ltd. (SSE: 688657), GstarCAD 2027 delivers 100% native AC1032 DWG compatibility, perpetual licensing, and zero-day AutoCAD parity.