DSTV file parser (core library)
Project description
dstvparser
dstvparser is a Python library for parsing and analyzing DSTV files commonly used in the structural steel industry.
It allows easy extraction of profile information, detection of inclined cuts, and basic automation of file classification.
Features
- Parse DSTV files and extract profile headers and geometry
- Support both
.ncand.nc1files - Detect inclined cuts on flanges and webs
- Classification and sorting of files based on detected features
- Modular structure: easy to extend or integrate into larger workflows
- Automatic parser selection via Factory (detects
.ncor.nc1)
or you can use a specific parser directly if needed
Clone the repository:
git clone https://github.com/serg-you-lin/dstvparser.git
Requirements
- Python 3.9+
Installation
You can install the package:
pip install dstvparser
Development notes
This project is under active development. Some features related to NC1 profiles are currently incomplete due to the lack of available sample files for proper development and testing. Contributions or example files are welcome to help expand support.
How to Use
Basic example
from dstvparser.parsers.nc_file_parser import NCFileParser
nc_file = "your_file.nc"
parser = NCFileParser(str(nc_file))
profile = parser.parse()
print(profile.get_header())
Example use case: Split Profiles by feature
One common use case is to split NC profiles based on profile type or specific geometric characteristics, such as the presence of holes or inclined cuts.
from dstvparser.parsers.nc_file_parser import NCFileParser
input_folder = "your_folder"
sets_by_type = {}
for file_path in input_folder.glob("*.nc"):
try:
parser = NCFileParser(str(file_path))
profile = parser.parse()
profile_type = profile.code_profile
if profile_type not in sets_by_type:
sets_by_type[profile_type] = []
sets_by_type[profile_type].append(file_path.name)
except Exception as e:
print(f"Failed to process {file_path.name}: {e}")
# Print grouped profiles
for profile_type, files in sets_by_type.items():
print(f"{profile_type}:", len(files))
This script:
- Scans a folder containing .nc files
- Parses each file using the NCFileParser
- Checks for inclined flange/web cuts
- Copies the file into either the Inclined cuts or Straights folder, accordingly,
allowing for organized separation and easier management of files based on their geometric features for further processing or review.
Inspection scripts
The examples folder contains manual inspection scripts. These can be run directly after installing the package with pip install -e ..
License
MIT License — feel free to use, modify, and share with attribution.
Contributions
Pull requests are welcome! If you find issues or have suggestions, please open an issue in the repository.
Author
Federico Sidraschi https://www.linkedin.com/in/federico-sidraschi-059a961b9/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dstvparser-0.1.2.tar.gz.
File metadata
- Download URL: dstvparser-0.1.2.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
189f1d9ed129e3ea07f5bf8f44913a8e3ed29edbf4fb89e8a4af23119cee654a
|
|
| MD5 |
285e05e1898512393c20ba113e39c3cd
|
|
| BLAKE2b-256 |
265824641e2b29ec6fad14f59ec5fd3d9d6dc6e223a14a30130f3bcfaff3668b
|
File details
Details for the file dstvparser-0.1.2-py3-none-any.whl.
File metadata
- Download URL: dstvparser-0.1.2-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8edaf29d4bfba1fce525197d539d239b3b3619effca1c3f6ce5ff91593c5dccc
|
|
| MD5 |
e5826331f23155b56cea8f27e2e48280
|
|
| BLAKE2b-256 |
8e9b07f5e54b1fee8da1447113a3965a6a712af2cb40662634771f15f6dc39de
|