this is 2D but not far from what you need
#pre made node
var building = preload("res://Building.tscn")
#place building at player or mouse pos
var stage_node = get_parent()
var building_instance = building.instance()
building_instance.position = Vector2(floor(position.x / gridsize), floor(position.y / gridsize))
stage_node.add_child(building_instance)
i think it's right(i haven't checked but should set you on the correct path)
Vector2(floor(position.x / gridsize), floor(position.y / gridsize))
math floor will get the tile you're in and convert to an int, i.e. convert it to a grid coordinates