Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- setlocal Enabledelayedexpansion
- :: .obj to cam converter
- ::
- :: USAGE:
- :: Save this piece of text as *.bat and drag & drop .obj file
- if [%1] == [] echo no file drop found & goto endMsg
- copy %1 %~n1_.txt
- set "file=%~n1_.txt"
- for /f "tokens=*" %%a in (%file%) do (
- set line=%%a
- if not "!line!"=="!line:v =!" (
- echo !line! >> %~n1.txt"
- )
- )
- del !file! /s /q >nul
- set /a "z=0" & for /f "tokens=2-4" %%a in (%~n1.txt) do (
- set /a "numTicks+=10"
- set /a "posX=%%a" 2>nul
- set /a "posY=%%c" 2>nul
- set /a "posZ=%%b" 2>nul
- if !z! lss 1 (
- set "campath=1_0/80/0/0/0/0/!posX!/!posY!/!posZ!;"
- set /a "z+=1"
- ) else (
- set campath=!campath!!numTicks!/80/0/0/0/0/!posX!/!posY!/!posZ!;
- )
- )
- echo !campath! > cam.tmp
- (
- for /f "usebackqdelims=" %%a in (cam.tmp) do (
- set "line=%%a"
- set "line=!line:; =;!"
- echo | set /p=!line!
- )
- )>"%~n1.cam"
- del *.tmp /s /q >nul
- del %~n1.txt /s /q >nul
- goto eof
- :endMsg
- pause >nul
Advertisement
Add Comment
Please, Sign In to add comment