
Include "Mapbasic.def"
include "icons.def"
include "menu.def"

Declare sub main
Declare sub Setka_koor

Sub Main
Create buttonpad "Сетка"  As ToolButton
icon MI_ICON_CROSSHAIR
Cursor  MI_CURSOR_CROSSHAIR
DrawMode DM_CUSTOM_RECT
Calling Setka_koor
helpmsg "\nСетка"
show

End Sub
sub Setka_koor
Dim x1,y1,x2,y2,dx,dy,dlt,deltaX,deltaY,delta as Float
Dim sym_marker As Symbol
Dim dom2 as Object

Set CoordSys table Setka
x1 = CommandInfo(CMD_INFO_X) 
y1 = CommandInfo(CMD_INFO_Y)
x2 = CommandInfo(CMD_INFO_X2) 
y2 = CommandInfo(CMD_INFO_Y2)
DeltaX=200 DeltaY=200 Delta=200
sym_marker = MakeFontSymbol(43,0,16,"Uzgeopunkt",0,0)

Set Style Symbol sym_marker 
       Delete From Setka
       Commit Table Setka
       Pack Table   Setka  Data     Interactive
Add Map Layer Setka
Set Map Layer  Setka
Display  Global Global Symbol (43,0,16,"UZgeopunkt",0,0)

'Note CurrentSymbol()
Dy=Round(y1,200)
While Dy < y2
Dx=Round(x1,200)
if dlt<0 then
Dx=dx+Delta
end if
while Dx < x2
'note 1
Create Point Into variable dom2 (dx,dy)
'Alter Object  dom2
 '     Info OBJ_INFO_SYMBOL,sym_marker
	
'Symbol sym_marker
insert Into Setka(obj) values (dom2)

Dx=Dx+DeltaX
Wend
dlt=dlt*(-1)
Dy=Dy+DeltaY
Wend




End Sub