This is just a quick tutorial on how I got his code up and running on my Windows 7 machine...
Download the software
- Download the Java program, http://www.thingiverse.com/thing:15276.
- Put it somewhere easily accessible-I made a new folder directly on my C: drive
- Another easy place is in your User folder C:\Users\your_username
- Update your Java (which is important to do anyway...)
- http://www.java.com/en/download/index.jsp
Setup Java for command line use
- To make most versions of Java work at the command line you need to add Java to the System PATH. This will allow you to call Java as a program from the command line.
- Find out where Java is installed and write down the file path down the the Bin file. On my machine:
- C:\Program Files\Java\jre7\bin
- Open the Start Menu, Right-click on Computer and click Properties.
- On the left hand side the window that opens...click Advanced System Settings.
- This will open another window, toward the bottom click the Environmental Variables button.
- In the bottom, System variables window, scroll down to the Path entry. Select it and click Edit.
- In the small window that pops up highlight the Variable Value field, scroll all the way to the end (to the right).
- Insert a semicolon after the last entry and type in the file path to Java.
Making a height field map
I'm writing this for geographers with some GIS knowledge in their back pockets. I'm using ArcMap to import DEMs and export the height maps, but there are plenty of other free/open-source options to do similar things; MicroDEM, qGIS, GrassGIS...(there are lots of tutorials).
- Download your DEM of choice. The National Map is a good place to start.
- Go for the lower resolution (1/3 or 1-arcsecond) data. The 1/9-arcsecond lidar-derived data makes for slow processing, unless it's a small area.
- SRTM data is also good for larger areas.
- Open your DEM in your GIS of choice.
- Clip it, Extract it by Mask...What ever you need to do to pull out the area you are interested in.
- Go the the Raster properties and ensure that the histogram stretch is Min-Max (or Linear in other software).
- Set the color ramp to a Black to White.
- In ArcMap...Right-click on the raster layer > Data > Export Data.
- Select Use Renderer, then set your Output Location, File Name, and set the format to PNG.
- Click Save.
- Check the exported PNG file. If there are large black areas, crop them from the image using an image editing software (quick and dirty is Microsoft Office Picture Manager, but Photoshop and other are good too).
- Move the file to the same place you put the Heightmap to STL program.
- Open up the Command Prompt (enter cmd in the Start Menu search box)
- Check that Java is working
- Type: java -version
- It should return a couple of fun lines about the current version of Java you have installed.
- Navigate to the folder with the program and PNG file. cd c:\ (you know the drill)
- Next, following Markus' instructions from Thingaverse, we''ll execute the program:
- Replace the items in 'quotes' with the actual variables you want to use. I'll show examples for a file I created for Yosemite Valley. (This is assuming your files are in the same place as the program)
- 'path to the image file' : yosm_val.png
- 'height of the model': you'll need to play with this one, this is how the program scales the 8-bit black to white values. It's also a vertical exaggeration. Start out with 100.
- 'height of the base': the thickness of the lowest point on the model. This will also need some playing. I start out with 10.
- The final command should look something like this:
java -jar heightmap2stl.jar 'path to imagefile' 'height of model' 'height of base'
java -jar heightmap2stl.jar yosm_val.png 100 10
Print Setup
Check out the exported STL file in a 3D model viewer, like Meshlab. If it looks good, we're off to our 3D printer. We have a Makerbot Replicator, so the screen captures are from MakerWare, but if you have another hardware/software combo the ideas are the same.
If you print topographic models the standard way, flat on the build platform with standard fill settings, you waste a lot of plastic in the empty parts of the model. So we've been trying to print the models up on an edge so that the printer only has to print the shells of the model and not any fill. This is pretty straight forward in MakerWare, just rotate the model 90 degrees along the X or Y axis to turn the model up on end. You can then rescale it and set it up on the platform.
Set the quality of your print to Standard or High, then adjust the advanced options. Set the Fill to 0% and add an extra shell (3-ish). Send it to the printer and cross your fingers.
Hi,
ReplyDeleteI'm having an issue of out of memory for Java heap space at com.heightmap.main.main(Main.java53)
any suggestions?
Thanks
Sarah
Sarah,
DeleteYou probably need to increase your default heap size. You can do as you run the program with the -Xmx option. The example below would increase the max memory to 2 GB (2048 MB) (you are only technically limited by your RAM).
java -Xmx2048m -jar heightmap2stl.jar...
If you increase your memory and still get an error, the only other option is to either create a lower resolution DEM or break it into tiles.
James thanks so much for your response. I have 8gb of ram but when I tried to increase heap size to 2048, I received an error that I could not reserve enough space for object heap. Is there a limit I should adjust or do I need to purchase more ram. thanks so much.
DeleteHi
ReplyDeleteI'm receiving this error message.
java.lang.NegativeArraySizeException
at com.heightmap.Main.main(Main.java:75)
Any suggestions?
Thank you
Francois
Sorry Francois, I've never seen that error before.
DeleteHi Francois, I've justr received the same error. Did you end up solving this issue? Cheers, Al.
DeleteHi James,
ReplyDeleteI am doing the similar research following the steps you wrote.
However, when I approach to the Section"Making a height field map", I have the following problems:
1. When downloading the DEM from the National Map Viewer, which format should I download, ArcGrid, GeoTiff or someothers?
2. How can I open DEM in ArcGIS and do the steps followed? I could not find the right button to click. Could you please show it step by step?
Also, in the section "Running the STL conversion", why did you set the "height of the model"as 100 and what does 100 mean?
I am a beginner in this field and thanks so much for your time and attention.
Yi
I have a DEM in ArcGIS 10.1 that I would like to get into STL format for a 3D printer. Does anyone know some software that will allow me to make this conversion?I have to use the STL format because that is the format required by my university's 3D printer.
ReplyDeletejava barcode creator
Hi,
ReplyDeleteI'm trying to use my own data sets from other places, like .tiff files from WorldDEM or SRTM. Is there a way I can do this with this application? I got stuck at the "making a height map" section as I couldn't find a way to add the data I have.
Thanks
Kelsey,
DeleteThe trick is to convert the TIF files into PNG or JPEG with a grayscale (8-bit) color ramp. You normally need to use a GIS (ArcMap, GRASS, QGIS...) to do this because most image manipulation programs (Photoshop, GIMP) cannot handle the image headers that GeoTiff files have. I know there are some workarounds to get GeoTiff files into Photoshop, but I do not know how well they would work for this process.
Hi, thanks for the guide!
ReplyDeleteWorked like a charm. Thank you!
ReplyDeleteThere are so many uses of a 3D laser scanner such as an as-built drawing of bridges, monuments, or industrial plants. If you need the best 3D laser scanning service in Alberta then you can visit our site. Best 3D scanning service Grand Prairie, Alberta
ReplyDeleteChoosing 3d printers
ReplyDeletecan be a daunting task and entails balancing price, speed, and print quality. In order to figure this out you first need to figure out whether a laser printer or inkjet printer is best for your needs.
dimeapp.in is one of the fastest Live cricket score app performing in the arena of Cricket match scores and You can choose any upcoming match of your choice to watch it over and get full insights over Match history.
ReplyDeletedimeapp.in is an Ads free cricket app which makes your cricket viewing experience even more exciting plus Accurate match odds with session updates, Search matches date-wise, team-wise, and series-wise too.
dimeapp.in is 100% free to download and use an app for viewing All T20, ODI, Domestic and International women/men Test Matches and even IPLs and PSL. You can even watch the World Cup, Asia Cup and upcoming schedules of upcoming matches in this App.
dimeapp.in is the No.1 rating app on our list. This app is a lifeline for cricket lovers. Not only, it is interactive & convenient-to-use software, but it furthermore wraps all aspects of cricket.
It will give to the detailed stats, rankings & records, Precise odd-even sessions. Even it also helps to skillfully navigate team/date/year wise matches. It also provides daily articles & alerts on feverish cricket headlines.
As per reviews and information on the Internet, we will recommend dimeapp.in for a cricket lover to satisfy their craving to know the scores fastest of fast that too with free-subscription & Ads-free...
I do not care whether working traditionally, or digitally, or both. I am interested in producing the best possible, long lasting images and to me, a mix of digital and traditional is what works. free 3d models download
ReplyDeletePro dissertation writing provides the best Academic Writing Services , we are one of the leading academic writing company in UK.
ReplyDeletejava.io.FileNotFoundException: heightmap.stl (Access is denied)
ReplyDeleteat java.io.RandomAccessFile.open0(Native Method)
at java.io.RandomAccessFile.open(Unknown Source)
at java.io.RandomAccessFile.(Unknown Source)
at com.heightmap.stl.StlObject.writeToBinary(StlObject.java:231)
at com.heightmap.stl.StlObject.save(StlObject.java:306)
at com.heightmap.Main.main(Main.java:262)
I keep getting this error. How do I fix this?