This Python script reads a text file containing a list of numbers (such as node or element IDs), sorts them, removes duplicates, and groups consecutive numbers into compact ranges – just like MSC Patran’s range format. It’s a handy tool for preprocessing or organizing large ID lists efficiently.

Input file: elems.txt

Output file: ranges.txt

 

Discover more from Tips and Hints for Aerospace Engineers

Subscribe now to keep reading and get access to the full archive.

Continue reading