View Issue Details

IDProjectCategoryView StatusLast Update
0000572FreeCADFeaturepublic2012-01-16 20:43
ReporteryorikAssigned Towmayer 
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Product Version 
Target VersionFixed in Version0.13 
Summary0000572: add a method to Part module to read BRep data from string
DescriptionWerner or J├╝rgen (or anyone else with skills), would it be possible to add a python method to the Part module to create a shape from Brep data as a string? (Same as read() but it would take the contents of the file instead of the filename).

This is so other OCC-based software (such as IfcOpenShell) can pass us brep data directly via a python string.

It looks like the BrepTools read function can do that (link below), Sorry for asking something I could do myself, I tried to do it but got totally lost with strings/char*/Standard_Istream conversions...

Thanks
Yorik
Additional Informationhttp://opencascade.sourcearchive.com/documentation/6.3.0.dfsg.1-1/classBRepTools.html
TagsNo tags attached.

Relationships

child of 0000764 closed Serialize Shape to python String 

Activities

wmayer

2012-01-16 19:27

administrator   ~0001581

The implemented method is even more flexible. Instead of a string it uses an object with a read(int) method, such as a file object or a StringIO.

Example:

# a file object
f=open("box.brep")
s=Part.Shape()
s.importBrep(f)
Part.show(s)

# a string object
import StringIO
f=open("box.brep").read()
s=Part.Shape()
s.importBrep(StringIO.StringIO(f))
Part.show(s)

Done in rev 5410

yorik

2012-01-16 20:43

administrator   ~0001584

Werner, you are the BEST!
Thanks a lot!

Issue History

Date Modified Username Field Change
2012-01-16 14:21 yorik New Issue
2012-01-16 16:42 wmayer Status new => assigned
2012-01-16 16:42 wmayer Assigned To => wmayer
2012-01-16 19:27 wmayer Note Added: 0001581
2012-01-16 19:27 wmayer Status assigned => closed
2012-01-16 19:27 wmayer Resolution open => fixed
2012-01-16 19:27 wmayer Fixed in Version => 0.13
2012-01-16 20:43 yorik Note Added: 0001584
2012-06-28 13:43 wmayer Relationship added child of 0000764