You can come to Thailand and prepare your documents but then you have to leave the country to where you are applying and stay there until approved.
Tourist visas are 60 days you can extend 30 days in country once.
If you mean visa exempt they are also 60 + 30 unless you come from one of the four countries that get 90 days visa exempt. Brazil is one. I can't remember the others.
Anonymous participant 190 in theory, but dont bank on getting a second entry if you have a history or get on officer on a bad day. Go with a visa run company or 'fast track'.