SURVEY & DATA EXTRACTION

How to Extract X, Y, Z Coordinates of Points, Blocks & Polylines to CSV / Excel in GstarCAD

Export survey monument coordinates, piling centers, and block attributes from GstarCAD directly to CSV or Excel spreadsheets using DATAEXTRACTION or AutoLISP.

⚡ Quick Engineering Answer (TL;DR)

Run the built-in DATAEXTRACTION wizard (or EATTEXT) in GstarCAD, select 'Point' or 'Block Reference' objects, check Position X, Position Y, Position Z (plus any block attributes like POINT_ID), and output directly to .csv or .xls. Or run our 1-click AutoLISP PENZD exporter.

1. Root Cause & DWG Database Symptom Analysis

Civil surveyors, structural piling engineers, and MEP layout crews frequently need to extract a schedule of Point ID, Easting ($X$), Northing ($Y$), and Elevation ($Z$) from a GstarCAD drawing into a `.csv` file for Total Station stakeout or Excel quantity takeoffs.

2. Step-by-Step Resolution in GstarCAD & AutoCAD

Step 1: Use the Built-In DATAEXTRACTION Wizard (No Coding Required)

Type DATAEXTRACTION (or EATTEXT), create a `.dxe` template, select the target objects in the drawing, filter to Point, Circle, or your specific survey Block, check Position X, Position Y, Position Z under the Geometry category, and export to `.csv` or `.xls`.

Step 2: Export Ordered LWPOLYLINE Vertices for Boundary Stakeout

Standard `DATAEXTRACTION` extracts block/point centers, but what if you need the sequential $X, Y$ corner coordinates of a closed property parcel `LWPOLYLINE`? Use the `LIST` command or the AutoLISP vertex/point exporter below.

Step 3: Instant PENZD CSV Export via AutoLISP

Load the routine below and run EXPORT-XYZ-CSV: select any combination of `POINT`, `CIRCLE`, or `INSERT` (blocks), and GstarCAD writes a clean `PENZ` CSV file ready for Leica/Trimble/Topcon survey controllers.

3. System Variables & Command Diagnostic Table

Variable / Command Default / Target Value Diagnostic Function & Fix Behavior
DATAEXTRACTION Built-in Wizard Extracts X, Y, Z plus Block Attributes to CSV/XLS or CAD Table
EXPORT-XYZ-CSV AutoLISP Utility Exports POINT, INSERT, and CIRCLE centers to CSV in 1 second
LIST Quick Inspection Prints sequential vertex X,Y coordinates of selected Polylines
LUPREC = 4 Precision Variable Controls decimal precision in LIST output (rtos uses explicit 4)

4. One-Click AutoLISP Fix Script (AutoLISP 1-Click Point / Block / Circle X,Y,Z to CSV Exporter)

(defun c:EXPORT-XYZ-CSV ( / ss fn fp i ent elist pt lay)
  (if (and (setq ss (ssget '((0 . "POINT,INSERT,CIRCLE"))))
           (setq fn (getfiled "Save XYZ Coordinates CSV" "Survey_Coords.csv" "csv" 1)))
    (progn
      (setq fp (open fn "w") i 0)
      (write-line "ID,Layer,X_Easting,Y_Northing,Z_Elevation" fp)
      (while (< i (sslength ss))
        (setq ent (ssname ss i) i (1+ i) elist (entget ent)
              pt  (cdr (assoc 10 elist)) lay (cdr (assoc 8 elist)))
        (write-line (strcat (itoa i) "," lay "," (rtos (car pt) 2 4) ","
                            (rtos (cadr pt) 2 4) "," (rtos (caddr pt) 2 4)) fp))
      (close fp)
      (princ (strcat "\n[CSV Export] Wrote " (itoa i) " coordinates to " fn))))
  (princ)
)

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 How to Extract X, Y, Z Coordinates of Points, Blocks & Polylines to CSV / Excel in GstarCAD 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)

  1. 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 / .dws standards file via CHECKSTANDARDS.
  2. Coordinate & Unit Integrity: Run -DWGUNITS or check INSUNITS, LUNITS, and MEASUREMENT to guarantee 1:1 metric (`mm`/`m`) or imperial (`in`/`ft`) block and Xref insertion scaling, with OSNAPZ = 1 preventing unintended 3D elevation drift.
  3. 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:

Need 100% Native DWG Compatibility Without Subscription Lock-In?

Engineered by Suzhou Gstarsoft Co., Ltd. (SSE: 688657), GstarCAD 2027 opens, repairs, and plots AC1032 DWG files with full command and AutoLISP parity.

Download Free 30-Day Trial → All Troubleshooting FAQs AutoCAD Migration Hub