Skip to content

Instantly share code, notes, and snippets.

@geekygravity
Created May 5, 2016 04:35
Show Gist options
  • Save geekygravity/08aaab0781d727f89265f66ca4e5ee7a to your computer and use it in GitHub Desktop.
Save geekygravity/08aaab0781d727f89265f66ca4e5ee7a to your computer and use it in GitHub Desktop.
A utility to parse and modify command args. Sits between LPub3d and L3P. This is not affiliated with L3P, LPub3d, or LDraw.org
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace L3P.utility
{
class Program
{
static void Main(string[] args)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < args.Length; i++)
{
// Remove option if it starts with -lgeo
string sPattern = "^(?:-lgeo)";
// Construct desired options for process.start
if (System.Text.RegularExpressions.Regex.IsMatch(args[i], sPattern))
{ }
else { sb.Append(args[i] + " "); }
}
System.IO.File.AppendAllLines(@"L3P-utility.txt", args);
System.IO.File.AppendAllText(@"L3P-utility.txt", sb.ToString() + System.Environment.NewLine);
System.Diagnostics.Process L3P = new System.Diagnostics.Process();
L3P.StartInfo.WorkingDirectory = "C:\\LDraw\\LPub3D\\3rdParty\\l3p1.4WinB";
L3P.StartInfo.FileName = "L3p.exe";
L3P.StartInfo.Arguments = sb.ToString();
L3P.Start();
// Press Enter to continue ...
// System.Console.ReadLine();
}
}
}
@geekygravity
Copy link
Author

geekygravity commented May 5, 2016

  1. Open Visual Studio Community 2015 ( or Visual Studio 2013 Express for Desktop etc. )
  2. In the VS2015 File menu, choose New > Project > Templates > Windows > Console Application
  3. Name the new Console Application "L3P-utility"
  4. Click [OK]
  5. In the VS2015 Solution Explorer, open "Program.cs" and paste in the above code
  6. In the VS2015 Toolbar, click "Start"
  7. Close the Console after it appears.
  8. Close VS2015
  9. "L3P-utility.exe" is now in "C:\Users\Username\Documents\VS2015\Projects\L3P-utility\bin"
  10. Copy "L3P-utility.exe" to "C:\LDraw\LPub3D\3rdParty\l3p1.4WinB"
  11. Open LPub3d
  12. In the LPub3d Configuration menu, Preferences > Rendering
  13. ... set POV-Ray: C:\POV-Ray\v3.7\bin\pvengine.exe
  14. ... set L3P: C:\LDraw\LPub3D\3rdParty\l3p1.4WinB\L3P-utility.exe
  15. ... set LGEO: C:\LDraw\LGEO
  16. ... Remember to reset "Preferred renderer" to "POV-Ray"
  17. Click [OK]
  18. In Windows File Explorer, go to "C:\Users\Username\Documents\LDraw\Models\Star Wars"
  19. Copy "4484 - X-Wing Fighter & TIE Advanced.mpd" to "C:\Users\Username\Documents\POV-Ray\v3.7"
  20. Remove spaces from filename, rename to "4484.mpd"
  21. Open "4484.mpd" with Notepad
  22. Remove spaces from all internal filenames: "4484-X-Wing.ldr" and "4484-TIE-Advanced.ldr"
  23. Double check you found all filename instances
  24. In the Notepad menu, File > Save
  25. In LPub3d menu, Open "C:\Users\Username\Documents\POV-Ray\v3.7\4484.mpd"

.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment