For anyone who is using the GridControl and wants to save the data.
This code reads the data from 2 columns in each of 2 GridControls ...
;;;------------------------------------------------------------
(DEFUN _extractGridData ()
(SETQ
;;.............. removed for clarity
)
(SETQ RowCount (ODCL_GRID_GETROWCOUNT CTA17-GridBalloons_F_X-Grid)
RowIndex 0
g:dataListX '()
)
(WHILE (< RowIndex RowCount)
(SETQ g:dataListX
(CONS (CONS (ODCL_GRID_GETITEMTEXT CTA17-GridBalloons_F_X-Grid RowIndex 1)
(ODCL_GRID_GETITEMTEXT CTA17-GridBalloons_F_X-Grid RowIndex 2)
)
g:dataListX
)
)
(SETQ RowIndex (1+ RowIndex))
)
(setq g:dataListX (reverse g:dataListX))
;;--
(SETQ RowCount (ODCL_GRID_GETROWCOUNT CTA17-GridBalloons_F_Y-Grid)
RowIndex 0
g:dataListY '()
)
(WHILE (< RowIndex RowCount)
(SETQ g:dataListY
(CONS (CONS (ODCL_GRID_GETITEMTEXT CTA17-GridBalloons_F_Y-Grid RowIndex 1)
(ODCL_GRID_GETITEMTEXT CTA17-GridBalloons_F_Y-Grid RowIndex 2)
)
g:dataListY
)
)
(SETQ RowIndex (1+ RowIndex))
)
(setq g:dataListY (reverse g:dataListY))
)
;;;------------------------------------------------------------
... and then writes it to disk using (ODCL_WRITEBIN <fnHandle> <data>) in the
c:CTA17-GridBalloons_F_SaveDataFile_OnClicked function.
Note that this uses the version of ODCL_WRITEBIN updated and posted here by dan yesterday ( should be included in Build Beta17 )
(DEFUN c:CTA17-GridBalloons_F_SaveDataFile_OnClicked (/ documentpath data fnHandle)
(_extractGridData)
(SETQ documentpath (GETFILED "Source File" (GETVAR "dwgprefix") "data" 1)
data (LIST g:dataListX g:dataListY)
fnHandle (ODCL_OPENBIN documentpath "w")
)
(ODCL_WRITEBIN fnHandle data)
(ODCL_CLOSEBIN fnHandle)
)
... and this is the data.
((("1" . "2000")
("2" . "3000")
("3" . "2000")
("3a" . "1000")
("3b" . "1200")
("4" . "1500")
("5" . "2500")
("6" . "2800")
("7" . "2000")
)
(("A" . "3000")
("B" . "3000")
("C" . "3000")
("D" . "3000")
("E" . "3000")
("F" . "3000")
)
)
... and the obligatory piccy ..