Jump to content

Parts list generator


lukasni

Recommended Posts

I am in the process of creating a small Java program that will generate a CSV-File with all installed Parts by reading the Parts subdir in the KSP directory. I'm doing this mostly as a practice project for myself and because I'm to lazy to keep my delta-V spreadsheet updated.

I thought i'd post an example output here to see if anyone would be interested in the program. If there is some interest I might flesh it out a bit more, maybe add a GUI for selecting the desired values or what ever else people might be interested in.

Here is some example output in the current form, required values can be changed very easily.


Part Full Mass Dry Mass vac Isp Thrust

Advanced S.A.S Module 0.8 0.8
FL-T32 Fuel Tank 18 2
FL-T16 Fuel Tank 9 1
FL-T200 Fuel Tank 1.125 0.125
LV-909 Liquid Engine 0.5 0.5 400 20

I also added an example generated File as an attachment so you can check it out in the spreadsheet application of your choice.

Link to comment
Share on other sites

Well, it doesn't really get any nicer than CSV in my opinion, just paste it into Excel and you've got it ordered nicely into columns. It's got the advantage that it can very easily be supported on any platform. I guess I could also display it as a table if I create a GUI for the program, but I don't know if that would be of any use to anyone, since it's harder to get into another program than the clear text file.

Link to comment
Share on other sites

A very useful utility, can I suggest adding a field to indicate the name of the folder for each part? ... Sometimes we just want to clean up the clutter and remove a part which is never used, but have to drill down to the part.cfg file before finding which folder to eliminate.

Link to comment
Share on other sites

Should be done in a scripting language. Here's an example written in batch. It has one or two problems, but I bet someone more skilled than I could make a better version. This only took about 20 minutes to write, including looking up switches for commands, and I'm not even skilled at batch! Use the right tool for the right job. Personally I think that Java is way overkill for something as simple as this.

By the way, the .bat file goes in your parts directory. It's uploaded as a .txt file because for some reason I'm not allowed to upload files with arbitrary file extensions.

Link to comment
Share on other sites

I'm aware that it can be done with a scripting language, as I said in my first post, my main incentive for writing this was practicing Java for myself. The advantage of creating this in Java is that it can be used on any platform that supports KSP and it can be used by people that don't want to get their hands on command line tools etc. Just because you can write this in 20 minutes does not mean everyone else can do the same.

Link to comment
Share on other sites

There are currently only two platforms that support KSP, and even considering the time it takes to write a script for each one that time would still be quicker than making a program in Java. Now if you want to write one because you like practicing, go ahead, I'm just pointing out a few relevant things. People wouldn't have to "get their hands on command line tools", it's just a simple, automated built-in script. There are a few other pros as well, e.g easier editing, since the language is simpler. To finish off, no, just because I can write it in 20 minutes does not mean everyone else can do as well, some are even quicker. The file I submitted is about 20 lines of code. If you think about it I was really slow. Considering this is a relatively simple project, consider it an opportunity to familiarize yourself with other languages. If batch or shell scripting doesn't interest you, then perhaps you would like to try out Python with a relevant library to ease interaction between the code and the system.

Edited by Anonymous
Link to comment
Share on other sites

  • 3 weeks later...

THREAD DEVOTED TO THIS APPLICATION!

The version in this post is now obsolete.

I'm fairly new to this forum, as you can probably tell from my lack of posts :D... I got bored and saw this thread and made something in C# using this concept and would like any and all feedback. I'd like to move on into plugin development at some point but this small application shall be my first step into the KSP development arena.

img1.png

It has features to export to portable text files:

img2.png

It is also extensible with a fields file so you can change what it displays to whatever you want.


// This is a file which contains details to gather information from the part files. It is not required
// as the application holds some default values which it can use. But this file can be used to add
// greater customisation. Allowing this application to better suit your requirements.

// Static variables include %dirname% for the part directory.

// Below is a copy of what is already installed as the default field settings within the application.

Full Mass = mass = 60
Dry Mass = dryMass = 60
vac = vacIsp = 60
Isp = Isp = 60
Thrust = maxThrust = 60
Directory Name = %dirname% = 234

The ReadMe file also has some more in-depth details of the application's workings.


This project was programmed by CYBUTEK using C# and should work any computer capable of
running KSP either via the Microsoft .NET Framework 4.0 or MONO on Mac OS (untested).

Concept by lukasni
http://kerbalspaceprogram.com/forum/showthread.php/16227-Parts-list-generator



Installation
------------
1. Place the .exe in the KSP root directory next to KSP.exe.
2. (optional) Place the fields.txt file with the executable
or create your own :)
3. Double click to run (do I really need to explain this?!?! hehe)



Export to CSV
-------------
Clicking the 'Export to CSV' button will allow you to save all of the fields displayed into
either a tabbed or comma seperated file with the extention types (.csv and .txt). You can also
save it as any other extention you choose but it will default to tab seperated.


Using the "fields.txt" file
---------------------------
If you would like to use fields that are available within parts files that are not programmed
in via default, then this is where you do it. Example would be if you wanted to add a field
showing electrical power for solar panels or kethane extraction amounts on drills etc. The
synatax of the file is marked out in the commenting within the file.

Note that the file comes set with a copy of what is preset within the application. This is
because if the file is found, the application will ignore any built in presets. If there's
nothing in the file or it is commented out, you will get no fields being displayed.

Get the ZIP file Here!

Let me know what you think and if there is anything I've missed out which could be useful.

Thanks

Edited by cybutek
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...