In building my minerals add-on I've been helped by this script, which allow to assign more coordinates to the same name, useful whether one wish to place ricorsive objects (mines in my case).
For example:
gold mines coordinates (shorten):

# Author Fenerit <fenerit@interfree.it># Version 1.0, 31.10.2009# This script build a structured Celestia's location .SSC file from a LongLat table.# Such coordinates will be assigned to an user-defined location, # (see below how to do whether you have LatLong instead).# Acknowledgements: Dr. Fridger Schrempp <www.celestialmatters.org> for its basic routines.

# USAGE:# 1) Script and coordinates' text files must be in the same folder;# 2) Trim the space at init and at end of the LongLat table if any;# 3) Replace float commas with dots (for example: -109,24330 > -109.24330) if any, and save;# 4) Run the script. A new file called "longlat2locs.ssc" will be created in the same folder;

Note: real minerals add-on use "Au" instead of "Gold mine"; here just for marking. There is a bit of uncompleteness, of course; the usual trimmin and the commas>dots substitution in case these latters did have.

# Author Fenerit <fenerit@interfree.it># Version 1.1, 14.11.2009# This script build a structured Celestia's location .SSC file from a LongLat table.# Such coordinates will be assigned to an user-defined location, # (see below how to do whether you have LatLong instead).# Acknowledgements: Dr. Fridger Schrempp <www.celestialmatters.org> for its basic routines.

# USAGE:# 1) Script and coordinates' text files must be in the same folder;# 2) Run the script. A new file called "longlat2locs.ssc" will be created in the same folder;

Perl is fun, isn't it? I am glad to see some brave people using it, too!

Fridger

Thanks! But note the differences between a true programmer and a disgrace like me: 15 days to find the commas/dots conversion. A thing that the former probably "find" in half second!

Perl has some MOST powerful "secrets": one is the use of regular expressions aka patterns along with operations that act upon such patterns. There are really good respective tutorials in the net with many examples. For a C++ programmer, Perl's object oriented structures come most familiar, of course. Also in general, there are many syntactic similarities to C++.

Moreover, for writing Perl code, it is most crucial to realize that Perl acts on a line-by-line basis and your code acts like a sophisticated filter for the input file! Generically, one reads some ascii-text in, looks for certain patterns line-by-line, and then applies some operation on the found lines, satisfying the prescribed pattern criteria.
More complex stuff along these lines can be done using ( ) parenthesis pairs in the desired pattern that can be further worked upon with $1, $2 ... carrying the contents of the matched subpatterns in the successive parentheses!

Your suggestions will be hold with the due consideration. As newbie, the thing that has shocked me up mostly is the stability and flawless of the "brute force" - like with which it render the output. You know that DOS-Windows systems are unstables for itselves, so you can imagine my skepticism about a new language/interpreter managed within a graphical interface; crashes were my first preoccupations. Insted NOTHING of all this. Whether certain parts of the code doesn't work, Perl stop itself very clean and without problems (I can assure to you that my code errors are terrific). I really like this language.

This post is more for care than for other. Whereas the former set of coordinates are real US gold mine, the latters are japanese Aluminium processing plants, not gold mine. They was taken as an example.

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum