Coder Social home page Coder Social logo

steputils's People

Contributors

mozman avatar w0rm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

steputils's Issues

Error when reading stepfiles with special charracters

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?

Get coordinates from entities

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.

read existing STEP files

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

.step file parsing error

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.