mozman / steputils Goto Github PK
View Code? Open in Web Editor NEWSTEPutils is a Python package to manage STEP model data.
License: MIT License
STEPutils is a Python package to manage STEP model data.
License: MIT License
The method steputils.p21.HeaderSection.set_file_name assumes the parameter preprocessor_version
to be a tuple. This seems incorrect according to the examples on Wikipedia and in the Usage Guide for the STEP PDM Schema (e.g. page 21 --> page 31 of PDF).
Instead, the author
field looks like it should be a tuple.
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 6945: invalid start byte
When I manually search for the special characters and delete them in the file then it works.
Can the code do this internally -> to skip the special characters if it finds any?
Hi @mozman
I'm using this parser and I would be glad if you can help me.
I have this code so far:
from steputils import p21
# Read the STEP file
file_path = r'step.STP'
stepfile = p21.readfile(file_path)
entities_to_get = []
for entity in stepfile.data:
for instance in entity.instances:
instance_params = stepfile.get(instance)
if hasattr(instance_params, 'entity') and hasattr(instance_params.entity, 'name'):
if instance_params.entity.name == 'TESSELLATED_SHELL':
for param in instance_params.entity.params:
for i in param:
if i.startswith('#'):
entities_to_get.append(i)
print(f'entities_to_get: {entities_to_get}')
Which print:
entities_to_get: ['#27', '#28', '#29']
Now, with these entities, how can I get the respective coordinates?
Maybe with those entities, I have to use a library like pythonOCC?
Thanks in advance.
I have been found following list of bytes can not decode
X\E0
\X\E1
...
\X\E9
\X\AD
\X\AE
\X\F6
Hello,
i want to make a program, that extracts the name of parts out of a STEP file. For this i m using the p21.py and the Functions p21.readfile().
` stepfile = p21.readfile(FNAME) #works fine
stepfile = p21.readfile("C:\Users\maxim\Desktop\...\plate203.STEP") # doesnt work
`
I dont have a clue why it doesnt work. I tried to modify the path with an r in front of it, etc. Nothing works...
Thanks for your help :)
Greetings
Egon
I am unable to read a step file.
These .step file are coming from Rhino & Creo professional tools
I keep getting the following error.
File "D:\Progam Files\Python\python v3.7.0\lib\site-packages\steputils\p21.py", line 1025, in readfile
return load(fp)
File "D:\Progam Files\Python\python v3.7.0\lib\site-packages\steputils\p21.py", line 1019, in load
return loads(content)
File "D:\Progam Files\Python\python v3.7.0\lib\site-packages\steputils\p21.py", line 1003, in loads
return Parser(lexer).parse()
File "D:\Progam Files\Python\python v3.7.0\lib\site-packages\steputils\p21.py", line 633, in __init__
self.tokens = list(lexer.parse())
File "D:\Progam Files\Python\python v3.7.0\lib\site-packages\steputils\p21.py", line 505, in parse
yield step_decoder(self.string()) # str
File "D:\Progam Files\Python\python v3.7.0\lib\site-packages\steputils\p21.py", line 557, in string
raise ParseError(f'Found invalid character in string "{current}".')
steputils.exceptions.ParseError: Found invalid character in string "
".
When I open the .stp files in notepad++ text editor, the encoding is UTF-8.
I tried changing the file encoding to ISO 8859-1 without any success.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.