Importing STL file fails and produces a python error - Mac #40949

Closed
opened 2014-07-04 12:44:41 +02:00 by Patrick Taylor · 14 comments

System Information
OS: Mac OSX 10.6.8 (iMac)
RAM: 8gb
Graphics card: ATI Radeon HD 5750

Blender Version
Broken: 2.71 official Mac version
Worked: 2.70 offical
Works also on official Windows version 2.71 running under Parallels Desktop on the same iMac.

Short description of error
When I try to import an STL file, an error message is produced Screen_shot_2014-07-04_at_11.36.47.png. This originally happened when the STL file was located on a memory stick but I have also tried it when it is located on my desktop and also in my home folder - none of these work. This first happened with a file downloaded from the internet but it also occurs with a STL simple file exported from Blender itself of the default cube - both in ASCII and binary format.

P.S. First time I've reported a bug - hope I did everything correctly.

**System Information** OS: Mac OSX 10.6.8 (iMac) RAM: 8gb Graphics card: ATI Radeon HD 5750 **Blender Version** Broken: 2.71 official Mac version Worked: 2.70 offical Works also on official Windows version 2.71 running under Parallels Desktop on the same iMac. **Short description of error** When I try to import an STL file, an error message is produced ![Screen_shot_2014-07-04_at_11.36.47.png](https://archive.blender.org/developer/F96698/Screen_shot_2014-07-04_at_11.36.47.png). This originally happened when the STL file was located on a memory stick but I have also tried it when it is located on my desktop and also in my home folder - none of these work. This first happened with a file downloaded from the internet but it also occurs with a STL simple file exported from Blender itself of the default cube - both in ASCII and binary format. P.S. First time I've reported a bug - hope I did everything correctly.
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @paddy10663

Added subscriber: @paddy10663

Added subscriber: @mont29

Added subscriber: @mont29
Bouchard Guillaume was assigned by Bastien Montagne 2014-07-18 14:53:47 +02:00

Not quite sure why using mmap to read a file? Looks like it’s generating some issues on OSX…

Not quite sure why using mmap to read a file? Looks like it’s generating some issues on OSX…
Author

I've had a go at fixing this and it seems to work on both Windows and Mac Blender 2.71 - not tested Linux. However this is the first time I've done anything like this so I'm at a bit of a loss at what to do now; i.e. how do I submit the potentially fixed script? Could anyone help please?

I've had a go at fixing this and it seems to work on both Windows and Mac Blender 2.71 - not tested Linux. However this is the first time I've done anything like this so I'm at a bit of a loss at what to do now; i.e. how do I submit the potentially fixed script? Could anyone help please?

@paddy10663 just place your modified addon's code here (either as a diff or just whole code), I’ll review it, test under linux, and commit if everything is OK. :)

@paddy10663 just place your modified addon's code here (either as a diff or just whole code), I’ll review it, test under linux, and commit if everything is OK. :)
Author

I've attached the file with the changed code (not quite sure what a diff is or how to make one).
I've removed the use of mmap and replaced it with the 'open' command. There is also a slight increase in speed when importing stl files - in most cases negligible but nice to know.

I'll just reiterate that I am somewhat new to all this; I think I've done everything correctly but please say if I have not.

stl_utils.py

I've attached the file with the changed code (not quite sure what a diff is or how to make one). I've removed the use of mmap and replaced it with the 'open' command. There is also a slight increase in speed when importing stl files - in most cases negligible but nice to know. I'll just reiterate that I am somewhat new to all this; I think I've done everything correctly but please say if I have not. [stl_utils.py](https://archive.blender.org/developer/F99824/stl_utils.py)

Added subscriber: @guillaum

Added subscriber: @guillaum

Yep, replacing mmap stuff by mere plain open was my first idea too, then I thought author must have had some reason to use mmap… :/

Let’s give @guillaum one more week, and if no reactions I’ll simply apply that fix.

Yep, replacing mmap stuff by mere plain open was my first idea too, then I thought author must have had some reason to use mmap… :/ Let’s give @guillaum one more week, and if no reactions I’ll simply apply that fix.

Hello,

Sorry for latency in my response.

I used MMAP because on my initials tests it was far more efficient than using many reads. (But keep in mind that my tests where on huge meshs of a few gigabytes). Also, this code was "trivially" ported from my personal base code where I was also working on STL with random access, and mmap is more efficient at random access than a bunch of read.

But if it works efficiently without mmap, of course we can remove mmap.

Good luck on that work, unfortunately I cannot contribute more to it (Time is unavailable and I cannot contribute to project related to CG because of my current work... sorry.)

Hello, Sorry for latency in my response. I used MMAP because on my initials tests it was far more efficient than using many reads. (But keep in mind that my tests where on huge meshs of a few gigabytes). Also, this code was "trivially" ported from my personal base code where I was also working on STL with random access, and mmap is more efficient at random access than a bunch of read. But if it works efficiently without mmap, of course we can remove mmap. Good luck on that work, unfortunately I cannot contribute more to it (Time is unavailable and I cannot contribute to project related to CG because of my current work... sorry.)

Thanks @guillaum, will handle that then. :)

Thanks @guillaum, will handle that then. :)
Bouchard Guillaume was unassigned by Bastien Montagne 2014-07-28 12:20:07 +02:00
Bastien Montagne self-assigned this 2014-07-28 12:20:07 +02:00

This issue was referenced by a3d8d01b0e

This issue was referenced by a3d8d01b0e24fc8ba3d31498b16f581c9968b80a

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit a3d8d01b0e.

Closed by commit a3d8d01b0e.
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#40949
No description provided.