further work on ifcopenshell integration

This commit is contained in:
Yorik van Havre 2012-01-06 18:39:17 -02:00
parent 30f97b3124
commit d54d644c0e
4 changed files with 271 additions and 157 deletions

View File

@ -138,6 +138,7 @@ def splitMesh(obj,mark=True):
def meshToShape(obj,mark=True):
'''meshToShape(object,[mark]): turns a mesh into a shape, joining coplanar facets. If
mark is True (default), non-solid objects will be marked in red'''
name = obj.Name
import Part,MeshPart
from draftlibs import fcgeo
if "Mesh" in obj.PropertiesList:
@ -177,21 +178,26 @@ def meshToShape(obj,mark=True):
# make sure that the exterior wires comes as first in the list
wires.insert(0, ext)
print "done sorting", wires
faces.append(Part.Face(wires))
if wires:
faces.append(Part.Face(wires))
print "done facing"
print "faces",faces
shell=Part.Compound(faces)
solid = Part.Solid(Part.Shell(faces))
name = obj.Name
if solid.isClosed():
FreeCAD.ActiveDocument.removeObject(name)
newobj = FreeCAD.ActiveDocument.addObject("Part::Feature",name)
newobj.Shape = solid
newobj.Placement = plac
if not solid.isClosed():
newobj.ViewObject.ShapeColor = (1.0,0.0,0.0,1.0)
return newobj
try:
se = Part.makeShell(faces)
solid = Part.Solid(se)
except:
pass
else:
if solid.isClosed():
FreeCAD.ActiveDocument.removeObject(name)
else:
if mark:
newobj.ViewObject.ShapeColor = (1.0,0.0,0.0,1.0)
newobj = FreeCAD.ActiveDocument.addObject("Part::Feature",name)
newobj.Shape = solid
newobj.Placement = plac
return newobj
return None
def removeShape(objs,mark=True):

View File

@ -2,7 +2,7 @@
# Resource object code
#
# Created: Thu Jan 5 19:10:05 2012
# Created: Fri Jan 6 18:11:49 2012
# by: The Resource Compiler for PyQt (Qt v4.7.3)
#
# WARNING! All changes made in this file will be lost!
@ -5697,114 +5697,132 @@ qt_resource_data = "\
\x00\x00\x00\x12\x00\x57\x00\x65\x00\x72\x00\x6b\x00\x7a\x00\x65\
\x00\x75\x00\x67\x00\x65\x08\x00\x00\x00\x00\x06\x00\x00\x00\x05\
\x54\x6f\x6f\x6c\x73\x07\x00\x00\x00\x04\x61\x72\x63\x68\x01\
\x00\x00\x06\x9c\
\x00\x00\x07\xb2\
\x00\
\x00\x26\x4b\x78\x9c\xed\x5a\x51\x53\xdb\x38\x10\x7e\xe7\x57\xe8\
\x72\x33\xed\xdd\x0c\x89\x12\x20\x14\x82\x93\x4e\x1b\xa0\x74\x86\
\x5e\x69\x93\xb6\x73\x4f\x8c\x63\x2b\xb1\x7a\xb2\x65\x24\xb9\x4e\
\x7a\x73\xff\xfd\x56\xb2\x9c\xc4\x71\x08\x85\xe4\x80\xeb\xd0\xa1\
\x83\xa5\x95\x77\x57\xdf\x7e\xda\x5d\x1b\x3b\x2f\xc7\x21\x43\xdf\
\x88\x90\x94\x47\xed\x4a\xa3\x56\xaf\x20\x12\x79\xdc\xa7\xd1\xa8\
\x5d\xf9\xd4\x3f\xad\x1e\x54\x5e\x76\xb6\x9c\x84\xce\x16\xed\xc1\
\xa2\xce\x16\x72\x3c\xe6\x4a\xd9\x79\x93\xd0\x56\xeb\x98\xba\x8c\
\x8f\xe0\x37\x1b\xf5\x88\x52\x70\xb3\x7c\x25\xbc\xc0\xc1\xd9\x1a\
\x58\x9c\x52\x7f\x44\x14\x32\xe3\x76\xe5\xc3\x17\x33\xac\xa0\xc8\
\x0d\x49\xbb\xb2\x4a\x87\x36\x85\x9c\x58\xf0\x98\x08\x35\xb1\x37\
\x8c\x08\x0f\x89\x12\x13\x23\x44\x8e\x20\x9e\x32\x57\xc8\x19\x77\
\xea\x0e\x1e\xdb\xc1\x44\x0f\x26\x76\x00\x1e\xa8\xa0\xd3\x7c\xd1\
\x74\x70\x76\x99\x4d\x07\x84\x8e\x02\xd5\xd9\xdf\x39\x74\xb0\xbd\
\x36\x3a\x71\xae\xd4\xc1\xb9\xf1\x65\x9e\xa4\x34\xf2\x79\xda\xa7\
\x8a\x11\xeb\x8c\x54\x02\x7c\xef\xbc\x21\x11\x11\x2e\x43\xd2\xee\
\xc5\xc1\x56\x50\x56\xc9\xdc\x09\x4f\x66\xd8\x7c\x7e\xcd\xc7\xe7\
\x66\xca\x6a\x5c\x30\x29\x63\xd7\x03\x45\x15\xbb\x81\x28\x09\x07\
\x44\x74\xf6\x1d\x6c\xaf\x32\xf7\xe7\x2d\x94\x54\x84\xae\x18\xd1\
\x68\x41\xc3\xe1\x4a\x0d\x54\x91\x70\x86\xe4\x7c\x2c\xdf\x08\x9e\
\xc4\xe0\x73\x1e\xcd\x51\x3e\xce\x96\x97\x8c\xab\x19\x58\x4b\xf0\
\xd2\x31\x47\xbd\x25\xa0\x95\x7d\x5a\x09\x9d\x35\x06\xac\x55\xd4\
\x73\x59\x36\x7b\xb9\x33\xb3\x3b\xdb\xd0\x12\x45\x67\x25\x45\x01\
\x17\xf4\x3b\x8f\xd4\x12\x55\x8b\xca\xca\x10\x9d\xbb\x03\xc2\x72\
\x4d\x4c\x0f\x0a\xb7\x2f\xc1\x88\x8c\x55\x61\xc1\x14\xa7\x63\x32\
\x74\x13\x06\xaa\x39\xe3\x02\x0d\xe1\x7f\xea\x32\xb6\x88\xd4\x72\
\xb8\xb2\xc9\xcc\xb7\x39\xe7\x71\xd1\xfb\xd2\x66\x34\xe1\x88\x28\
\xe1\xd0\x33\xd3\x2b\xb7\x01\x6b\x09\x2c\x55\x90\x37\x16\x76\x43\
\x80\x6a\x9d\x0f\xaa\xd5\x3a\x9b\xea\x73\xb0\x99\xbc\x69\x03\xe5\
\xf3\x40\xbf\x93\x33\x1a\x41\xa4\xa4\xf2\xe1\xb8\xb5\x2b\xf5\x45\
\xe8\x60\x45\x61\x26\xcf\x06\x7b\xf5\x42\x32\x98\x4a\x6d\x22\xd8\
\xa9\x17\x72\xc2\xcc\xad\x45\x85\xd7\x20\x9d\x01\x77\x0b\xa4\x8b\
\xb4\x31\x69\xf1\x42\x90\x61\x57\xc7\xfa\x75\xa2\x14\xc0\x98\x1f\
\x32\x2d\x8b\x41\x66\x78\x30\xc8\x64\x2b\x19\xc5\x39\xeb\xd3\x78\
\x39\xa9\xfa\x01\x95\x08\x7e\x54\x40\x90\x5f\x22\x58\x44\x52\xf4\
\x05\x48\x86\xf8\xe0\x2b\x24\xc5\x1f\xe7\x5a\xc9\x09\xa3\x73\xc1\
\x05\x33\xb7\x80\xbf\x20\x7e\x67\xa7\xd9\xd4\x49\xd8\x5f\x10\x8d\
\x04\x21\x51\xa7\x71\x08\xa1\xc9\x2e\x8b\xe2\x01\x4b\x48\xa7\xf1\
\x02\xa4\xe6\xaa\x18\xb6\x92\xa9\x1f\xf3\x5a\xc3\x7c\x12\xe9\x72\
\x73\x2d\xc3\x3c\x8b\x88\x86\xc9\x44\x0b\x8c\xdd\x15\x24\x6d\xee\
\xc2\x55\xc1\xcd\xd6\xde\x71\x1f\xdb\x3a\xbb\xa9\xd3\xef\xe0\x2c\
\x13\x4e\xd3\x64\x41\xbc\x6e\xd2\x5c\x2b\x65\x6e\x2c\x61\x82\x20\
\xf1\x54\x22\xc8\xc3\x65\xcd\x1b\xd2\xff\x53\xde\xbc\xcf\xbc\x79\
\x53\x2d\x5e\x2f\x73\xf6\x72\xb6\xdd\x6f\xfa\x6c\x34\xeb\x2b\xd2\
\xe7\xfe\xe1\xaa\xf4\x79\xb0\xff\x40\xe9\x73\x8a\xd5\xcf\x9b\x43\
\x8b\xc2\x82\xae\xb9\x75\x77\x68\xb7\x67\x2c\xfe\xb1\x86\xfb\xed\
\x69\x17\xd1\x30\xe6\x42\x6d\xba\xcb\xde\x5c\x8f\xbd\xbb\x5e\x8f\
\xbd\x7b\xc7\x92\xf1\x8c\xa9\xa3\x5f\x8e\xdf\x77\xfb\x7f\x5e\x9c\
\xa0\xb3\xfe\xbb\x73\x74\xf1\xe9\xf5\xf9\xdb\x2e\x7a\x76\x95\x70\
\x75\x54\xc5\xf8\xcb\x6e\x17\xe3\xe3\xfe\x71\x26\x85\x27\x62\x8c\
\x4f\xfe\xc8\xa4\x76\x51\xa0\x54\xdc\xc2\x38\x4d\xd3\x5a\xba\x5b\
\xe3\x62\x84\xfb\x1f\xf1\xc7\x93\x6e\x35\x50\x21\xdb\xab\x1b\xc8\
\x3d\x55\xf3\x95\x9f\xad\x7f\x36\x52\x47\x5b\xda\xb0\x96\xeb\x81\
\xb9\x26\xae\x9f\x5f\xc3\x03\xaf\x9b\x79\x9e\xdd\x70\x05\xf7\x07\
\x7a\x0f\xd6\xac\x07\xc0\x41\xd1\xb0\xd2\x86\x9d\xc5\xf9\xed\x52\
\x4d\x18\x41\x6a\x12\xe7\xf7\xeb\x5b\x81\xf3\x72\xce\x7c\xbc\x8d\
\x18\x45\x7f\xa3\x34\x00\xac\xab\x26\x0b\xb7\x10\x1c\xa5\x6a\x2a\
\xdc\xf8\x08\xfd\x63\xfc\xc3\x46\x53\xae\x16\xcf\xbb\x38\xe0\xfe\
\x04\x19\xb1\xb5\x01\x49\x30\x52\xd5\xa1\x1b\x52\x36\x69\x3d\x3f\
\x26\x5f\xdd\xcf\x09\xea\xb9\x91\x7c\x6e\x45\xba\x20\xb4\x0e\xe2\
\x7c\x65\x6a\x8a\x46\x6b\xaf\x5e\xcf\xe5\x5a\x59\x2b\xe2\x22\x74\
\xd9\xd1\x02\x50\x71\xd1\x54\xf6\x4c\x5b\x55\x3c\x6e\xd5\xe3\xf1\
\x74\x3c\xe0\x90\xe2\xc3\xc2\x14\x23\x43\x55\x98\x10\xc6\xaa\x99\
\xa9\x5e\xa9\xea\x80\x71\xef\xaf\x2a\x3c\xd8\x03\x9c\x2d\xf0\x44\
\x23\x35\x1d\xc2\xa2\x99\x1f\xa7\x90\xe3\x75\xe6\xd7\x67\x49\x00\
\x10\x50\xef\x15\x47\xc3\x24\xf2\x74\xe9\xde\x46\x40\x62\xa8\x01\
\xc4\x47\x6e\x64\xd6\xf4\xbc\x80\x84\x2e\x3a\x19\x03\xa8\x52\xa2\
\x21\x85\x90\xfc\x56\x23\xe3\xf8\x77\xe4\x7e\x73\x29\xb0\x16\x26\
\x02\x22\x48\xcb\x60\x1b\x3f\xa6\xbd\x6a\x37\x5c\x14\x40\x62\x6d\
\x97\x18\x2e\x15\x89\x75\x99\x94\x35\x8f\x87\x58\x26\xb1\x4e\x2b\
\x40\x14\x9f\x7c\xbb\xf4\xb9\x27\x31\xc9\x76\x8c\xe9\xd0\xdb\x19\
\xef\xda\x5f\x97\xca\x6b\xe8\xcd\x17\x6d\x00\xed\xa2\xe2\x6e\x8d\
\x4f\x3e\xf1\xb8\x30\x1d\x51\x0b\x25\xe0\x9f\x60\x34\x22\x47\x59\
\xad\x6d\xfd\xda\xac\x1f\x10\xff\x60\xce\xdb\xcd\x39\x67\x28\x0f\
\x3e\x4d\x19\xef\x4e\xaf\xe2\xe9\x95\x66\xfe\xec\x48\xd8\x13\xbc\
\xb9\xee\xf2\xbf\xed\xca\x2f\xf7\xd6\x4b\xb3\x7b\x77\x4c\xb3\x73\
\x27\xc2\x9c\x04\xa0\xa2\x09\xf0\xc3\x75\xe5\xab\x0b\xc6\x53\x57\
\xbe\x91\xae\xfc\x14\x62\xdd\x0d\x38\x97\x44\x94\xba\x72\xcd\x03\
\xcf\xca\xee\xdc\x93\x3f\x95\xef\xa7\xf2\x7d\xdf\xe5\x7b\xc9\xbf\
\xc7\x57\xc2\x67\x3d\xc6\xff\xac\x98\x43\x47\x54\x43\xd7\x54\x62\
\x1d\x44\x46\x3d\x12\x49\x38\xfb\x3a\x8c\x92\x47\x12\xa5\x04\xb9\
\xf0\xc8\x1d\x71\x85\x5c\xc6\x78\x0a\x41\x84\xd0\xca\x80\xc6\x10\
\x71\x57\x65\xb1\x7b\x7c\x11\x4a\xa9\x0a\xd0\x29\x3c\x98\x77\x5f\
\x1d\x6f\x23\xc9\x0d\x05\xc3\x44\x2a\xe4\xf3\x34\x62\xdc\xf5\x11\
\x55\x7a\x52\x48\xc2\x86\x35\x74\xc1\xe0\x90\xcf\xed\x88\x02\xda\
\x3c\x24\x8f\x6f\x63\x79\x6d\x47\xf0\xa3\xdd\x87\x58\x87\x71\xa2\
\x88\xd8\x86\xc3\xe5\x23\xd8\x0d\xf1\x94\x39\x8c\x66\x1f\x26\xe2\
\x1b\xed\xb1\xd6\x79\x2d\xf1\x76\xe8\x65\x47\xff\xa7\x7c\x23\xb1\
\x7e\xff\xd8\x5c\xaf\x7f\x6c\xde\xb1\x7f\xd4\x70\xea\x53\x0d\xe1\
\x79\x1f\x93\xa8\x17\x10\xc6\x1e\xae\x77\x5c\xdd\x05\x3f\xf5\x8e\
\xf7\xd9\x3b\xde\xf0\x46\xf7\x16\x47\x1f\x8a\x1b\xdc\x1a\xc9\x8c\
\x5b\x3f\xe1\xe9\xbf\xfd\xfb\xc8\xc2\x31\xc8\xdf\xfc\x15\xff\x18\
\xfc\x23\xec\x9f\x11\xff\xb3\xd5\x51\xa0\x7d\xf9\x2d\xe4\x2d\xc8\
\x5e\xe4\xb9\xa5\xf8\x4e\x89\xe2\x39\xbb\xf7\x4a\xec\x2e\x10\x7b\
\xd1\x95\x02\x9d\x67\x20\xcd\x21\x39\x07\xa3\x4d\xa7\xf9\xdf\x06\
\xec\xc7\x1b\xed\xca\x7e\xc5\xd6\xd4\x76\xa5\xd1\xa8\x60\xbd\x32\
\xa6\xe3\xd0\x8d\xf3\xf6\xb3\x73\x75\x61\xc6\xa7\x82\x87\xef\x68\
\x48\x7a\x50\x35\x3d\x02\xbe\x14\x57\xe9\x0f\x71\xa0\x3f\xe0\x61\
\x66\x51\x1a\x4f\xe6\x67\x32\x2f\xe7\x3e\xd6\x99\x3b\x43\xb3\x0f\
\x74\x74\x3c\xc6\xf0\x00\xe2\xcb\x8e\xfd\x38\x07\xa2\x61\x27\xb6\
\x32\xa8\x74\x7f\xac\x35\x60\xad\x20\xfb\x5a\xa7\x16\x38\xd8\x0a\
\x0c\x00\x8b\x76\x57\x3b\x32\xf7\xe7\x99\xe5\x8e\x5c\x24\x32\xc8\
\xe5\xd7\x39\x93\x39\x2b\xd7\xf3\x64\x21\xb5\x2c\xf5\xa6\x8c\xdd\
\x75\x2e\x69\x6d\x1b\x73\xeb\x26\x90\xca\x48\xae\xef\x56\x71\xc2\
\x7c\xbf\x05\x0d\xbf\xe1\x9f\x34\x4c\x85\x87\xd5\x88\x18\xfe\xe9\
\xb1\x83\x13\xda\xd9\xfa\x17\x2b\x0e\x9e\x7d\
\x00\x28\x75\x78\x9c\xed\x5a\xeb\x73\xd3\x38\x10\xff\xde\xbf\x42\
\x97\x9b\xe1\x31\xd3\x44\x49\xdb\x94\x36\x75\x7d\x03\x7d\x40\x67\
\xe0\x28\xb4\xc0\xdc\x27\xc6\xb1\x95\x58\x20\x5b\xc6\x92\x49\xc2\
\xcd\xfd\xef\xb7\x7a\x38\x7e\xa5\xe9\x23\xa1\x1c\x37\xcc\x14\x6a\
\x69\xa5\xdd\xd5\x4f\xab\xdf\xae\x5c\x3b\x7f\x4c\x23\x86\xbe\x92\
\x54\x50\x1e\x1f\xb6\x7a\x9d\x6e\x0b\x91\xd8\xe7\x01\x8d\xc7\x87\
\xad\x77\x97\xa7\xed\xbd\xd6\x1f\xee\x86\x93\xd1\x62\xd0\x0e\x0c\
\x72\x37\x90\xe3\x33\x4f\x08\xf7\x79\x46\x07\x83\x63\xea\x31\x3e\
\x86\xdf\x6c\x7c\x41\xa4\x84\xc9\xe2\x69\xea\x87\x0e\x36\x63\x60\
\xf0\x84\x06\x63\x22\x91\x6e\x1f\xb6\xde\x7c\xd0\xcd\x16\x8a\xbd\
\x88\x1c\xb6\x96\xe9\x50\xa6\x90\x93\xa4\x3c\x21\xa9\x9c\xd9\x09\
\x63\xc2\x23\x22\xd3\x99\x16\x22\x27\x25\xbe\xd4\x4f\xc8\x99\xba\
\x5d\x07\x4f\x6d\x63\xa6\x1a\x33\xdb\x00\x0f\x64\xe8\xf6\x9f\xf4\
\x1d\x6c\x1e\x4d\x77\x48\xe8\x38\x94\xee\xee\xd6\xbe\x83\xed\xb3\
\xd6\x89\x73\xa5\x0e\xce\x8d\x2f\xf2\x64\x42\xe3\x80\x4f\x2e\xa9\
\x64\xc4\x3a\x23\x64\x0a\xbe\xbb\xcf\x49\x4c\x52\x8f\x21\x61\xd7\
\xe2\x60\x2b\x68\xaa\x64\xde\x8c\x67\x05\x36\xef\x9f\xf1\xe9\x4b\
\xdd\x65\x35\xd6\x4c\x8a\xc4\xf3\x41\x51\xcb\x2e\x20\xce\xa2\x21\
\x49\xdd\x5d\x07\xdb\x27\xe3\x7e\xd9\x42\x43\x45\xe4\xa5\x63\x1a\
\xd7\x34\xec\x2f\xd5\x40\x25\x89\x0a\x24\xcb\x7b\xf9\x3c\xe5\x59\
\x02\x3e\xe7\xbb\x39\xce\xdb\x66\x78\xc3\xb8\x2c\xc0\x5a\x80\x97\
\xda\x73\x74\xb1\x00\xb4\xa6\x4f\x4b\xa1\xb3\xc6\x20\x6a\x25\xf5\
\x3d\x66\x7a\x3f\x6e\x15\x76\x8b\x05\x2d\x50\xf4\xa2\xa1\x28\xe4\
\x29\xfd\xc6\x63\xb9\x40\x55\x5d\x59\x13\xa2\x97\xde\x90\xb0\x5c\
\x13\x53\x8d\xca\xf4\x05\x18\x91\xa9\xac\x0c\x98\xe3\x74\x4c\x46\
\x5e\xc6\x40\x35\x67\x3c\x45\x23\xf8\x37\xf1\x18\xab\x23\xb5\x18\
\x2e\xd3\x69\x7c\x2b\x39\x8f\xab\xde\x37\x16\xa3\x02\x8e\xa4\x0d\
\x1c\x2e\x74\xf7\xd2\x65\xc0\x58\x02\x43\x25\xf0\x46\x6d\x35\x04\
\x42\xcd\x7d\x23\x07\x83\x17\x73\x7d\x0e\xd6\x9d\xd7\x2d\xa0\x79\
\x1e\xe8\x37\xf2\x82\xc6\xb0\x53\x42\x06\x70\xdc\x0e\x5b\xdd\x3a\
\x74\x30\xa2\xd2\x93\xb3\xc1\x4e\xb7\x42\x06\x73\xa9\x25\x82\xad\
\x6e\x85\x13\x0a\xb7\xea\x0a\xaf\x40\xda\x00\x77\x0b\xa4\xab\x61\
\xa3\x69\xf1\x3c\x25\xa3\x23\xb5\xd7\xcf\x32\x29\x01\xc6\xfc\x90\
\x29\x59\x02\x32\x1d\x07\x43\x23\x5b\x1a\x51\x9c\xb3\x4b\x9a\x2c\
\x0e\xaa\xcb\x90\x0a\x04\x3f\x32\x24\x28\x68\x04\x58\x4c\x26\xe8\
\x03\x04\x19\xe2\xc3\x4f\x40\x8a\x37\x8f\xb5\x86\x13\x5a\x67\xcd\
\x05\xdd\x57\xc3\x3f\x25\x81\xbb\xd5\xef\x2b\x12\x0e\x6a\xa2\x71\
\x4a\x48\xec\xf6\xf6\x61\x6b\xcc\x63\x55\x3c\x64\x19\x71\x7b\x4f\
\x40\xaa\x9f\xaa\xdb\xd6\x30\x75\x33\xaf\x15\xcc\x27\xb1\x4a\x37\
\x57\x46\x98\x6f\x11\x51\x30\xe9\xdd\x02\x63\x77\x05\x49\x99\x3b\
\xf7\x64\x78\xbd\xb5\x57\x3c\xc0\x36\xcf\xae\xeb\xf4\x3b\xd8\x30\
\xe1\x9c\x26\x2b\xe2\x55\x49\x73\x25\xca\x5c\x1b\x61\x82\x20\xf3\
\x65\x96\x92\x1f\xc7\x9a\xd7\xd0\xff\x2f\xde\xbc\x4f\xde\xbc\x2e\
\x17\xaf\xc6\x9c\x17\x79\xb4\xdd\x2f\x7d\xf6\xfa\xdd\x25\xf4\xb9\
\xbb\xbf\x8c\x3e\xf7\x76\x7f\x10\x7d\xce\xb1\xfa\xff\x72\x68\x55\
\x58\xd1\x55\x1a\x77\x87\x72\xbb\x88\xe2\x9b\x15\xdc\x67\xa7\x47\
\x88\x46\x09\x4f\xe5\xba\xab\xec\xf5\xd5\xd8\xdb\xab\xd5\xd8\xdb\
\x77\x4c\x19\x0f\x98\x3c\xf8\xed\xf8\xf5\xd1\xe5\x5f\xe7\x27\xe8\
\xc5\xe5\xab\x97\xe8\xfc\xdd\xb3\x97\x67\x47\xe8\xc1\x97\x8c\xcb\
\x83\x36\xc6\x1f\xb6\x8f\x30\x3e\xbe\x3c\x36\x52\xb8\x11\x63\x7c\
\xf2\xa7\x91\xda\x41\xa1\x94\xc9\x00\xe3\xc9\x64\xd2\x99\x6c\x77\
\x78\x3a\xc6\x97\x6f\xf1\xdb\x93\xa3\x76\x28\x23\xb6\xd3\xd5\x90\
\xfb\xb2\x13\xc8\xc0\x8c\x7f\x30\x96\x07\x1b\xca\xb0\x92\xab\x86\
\x7e\x26\x5e\x90\x3f\xc3\x85\xd7\x33\x9e\x9b\x09\x5f\x60\x7e\xa8\
\xd6\x60\xcd\xfa\x00\x1c\x24\x0d\x2b\xed\xd9\x5e\x9c\x4f\x17\x72\
\xc6\x08\x92\xb3\x24\x9f\xaf\xa6\x42\xcc\x8b\x92\xf9\x64\x13\x31\
\x8a\xfe\x46\x93\x10\xb0\x6e\x6b\x16\x1e\x20\x38\x4a\xed\x49\xea\
\x25\x07\xe8\x1f\xed\x1f\xd6\x9a\x72\xb5\xb8\xec\xe2\x90\x07\x33\
\xa4\xc5\xd6\x06\x90\x60\x2c\xdb\x23\x2f\xa2\x6c\x36\x78\x78\x4c\
\x3e\x79\xef\x33\x74\xe1\xc5\xe2\xa1\x15\xa9\x84\x30\xd8\x4b\xf2\
\x91\x13\x9d\x34\x06\x3b\xdd\x6e\x2e\x57\xca\x06\x31\x4f\x23\x8f\
\x1d\xd4\x80\x4a\xaa\xa6\xcc\x9d\xb6\x2d\x79\x32\xe8\x26\xd3\x79\
\x7b\xc8\x81\xe2\xa3\x4a\x17\x23\x23\x59\xe9\x48\xb5\x55\xdd\xd3\
\xfe\x22\xdb\x43\xc6\xfd\xcf\x6d\xb8\xd8\x03\x9c\x03\xf0\x44\x21\
\x35\x6f\xc2\xa0\xc2\x8f\x53\xe0\x78\xc5\xfc\xea\x2c\xa5\x00\x04\
\xe4\x7b\xc9\xd1\x28\x8b\x7d\x95\xba\x37\x11\x04\x31\xe4\x00\x12\
\x20\x2f\xd6\x63\x2e\xfc\x90\x44\x1e\x3a\x99\x02\xa8\x42\xa0\x11\
\x85\x2d\x79\xd4\x21\xd3\xe4\x31\xf2\xbe\x7a\x14\xa2\x16\x3a\x42\
\x92\x92\x81\xc6\x36\xf9\x2f\xad\x55\xb9\xe1\xa1\x10\x88\xf5\xb0\
\x11\xe1\x42\x92\x44\xa5\x49\xd1\xf1\x79\x84\x45\x96\x28\x5a\x81\
\x40\x09\xc8\xd7\x8f\x01\xf7\x05\x26\x66\xc5\x98\x8e\xfc\xad\xe9\
\xb6\xfd\xf5\x51\xfa\x3d\xb5\xf8\xaa\x0d\x08\xbb\xb8\xba\x5a\xed\
\x53\x40\x7c\x9e\xea\x8a\x68\x80\x32\xf0\x2f\x65\x34\x26\x07\x26\
\xd7\x0e\x7e\xef\x77\xf7\x48\xb0\x57\xf2\x76\x7d\xce\xe9\x90\x07\
\x9f\xe6\x11\xef\xcd\x9f\x92\xf9\x93\x8a\xfc\xe2\x48\xd8\x13\xbc\
\xbe\xea\xf2\xfb\x56\xe5\x1f\x77\x56\xa3\xd9\x9d\x3b\xd2\x6c\xe9\
\x44\xe8\x93\x00\xa1\xa8\x37\xf8\xc7\x55\xe5\xcb\x13\xc6\xaf\xaa\
\x7c\x2d\x55\xf9\x29\xec\xf5\x51\xc8\xb9\x20\x69\xa3\x2a\x57\x71\
\xe0\x5b\xd9\x9d\x6b\xf2\xf5\xb1\x72\x07\x29\x5d\x8c\xfa\x24\x16\
\xa0\x59\x69\x13\x3c\x16\x68\x42\x90\x07\x05\x7d\xcc\x25\x82\x0b\
\x3f\x9f\x80\x2e\xb0\x20\x42\x9a\x80\x61\x4f\x1a\x15\x13\x2a\x43\
\x74\x0a\x45\xf6\xd1\xd3\xe3\x4d\x24\xb8\xb6\x1b\x65\x42\xa2\x80\
\x4f\x62\xc6\xbd\x00\x51\xa9\x3a\x53\x41\xd8\xa8\x83\xce\x19\xe0\
\x5b\x9a\x4f\x81\x06\x79\x54\x1c\x0b\x04\x3f\x6a\x34\x70\x5e\x94\
\x64\x92\xa4\x9b\xb0\x80\x00\xc1\x64\xb8\x55\xe8\x05\xeb\x69\x2a\
\x7d\x74\xee\x7e\xc7\xb8\x45\xb5\x7e\x36\xf2\x0d\x74\xff\xcb\x42\
\x7d\x75\x5a\xed\xdf\x9c\x56\x8b\x2b\x6b\x48\xfc\xcf\xe5\xea\x7e\
\x7e\x5f\x55\x82\x61\xf1\x56\xfd\xf6\xc7\xe2\x6c\x04\x41\x62\x6e\
\xab\x5a\x19\x09\x36\x11\xe4\x3a\x50\x10\x8b\x90\x30\x06\x01\x0b\
\xff\x0d\x09\xca\x84\x89\x67\x1f\xc2\x5d\x12\x14\x11\x10\xc3\xb4\
\x18\x12\x29\xc4\x2c\x1f\x99\x77\xf4\x2b\xdf\x66\xaf\x4e\x0c\xef\
\x04\x1c\xde\x91\xff\x1a\x3c\xbb\x50\x9e\xdd\x4b\x34\xc3\xaa\xab\
\x36\x7f\xce\x98\xbe\x6d\xca\x5b\x9e\xbc\x7f\xa5\xbc\x55\x52\xde\
\xa2\x62\xa9\xbf\x14\x6f\x12\xab\x2b\x40\x50\x5b\xfe\x10\x8e\xb5\
\x3b\xf2\x98\x20\x0e\xd6\xcf\x6b\x3c\x6b\x2a\x50\xd5\x61\xbf\xd3\
\x79\xbb\x43\x34\xae\x56\x14\x5c\xf3\xaa\xee\xbb\xc1\x77\x0d\xaf\
\xaa\xcc\x1e\x7a\x5f\x49\x95\x4f\x15\x63\x42\x79\xa0\x78\x56\x24\
\xc4\xa7\xa3\x99\x4e\xce\x3a\x55\x27\x05\xec\x67\xfa\x25\x4c\x27\
\x99\xdd\x0b\xcd\x95\x3d\xfc\x59\x39\x6e\xcd\x2f\xd8\x2a\x04\x99\
\xbf\xca\xaa\xfe\x75\xf3\x26\xbc\x58\x50\xe2\x7b\xab\xa3\x42\x88\
\xcd\xd7\x6a\xb7\xa0\xc1\x2a\x03\x5a\xf2\xdb\x6a\x90\x5f\xce\x7b\
\x3b\x0d\xde\xab\x50\x5e\xdd\x95\x0a\xd1\x15\x20\x95\x90\x2c\xc1\
\x68\x0b\xa1\xfc\x65\xb7\xfd\x1a\xe1\xb0\xb5\xdb\xb2\xaf\x18\x0e\
\x5b\xbd\x5e\x0b\xab\x91\x09\x9d\x46\x5e\x92\x17\xde\xee\x97\x73\
\xdd\x3e\x4d\x79\xf4\x8a\x46\xe4\x02\x6a\x59\x1f\x8e\x64\x6d\x94\
\xfa\xb2\x04\x8a\x64\x1e\x19\x8b\x42\x7b\x52\xee\x31\x5e\x96\xbe\
\x3e\x29\x71\x47\xf1\xc5\x89\xda\x8f\xa9\x24\x71\x20\x5c\xfb\xb5\
\x09\xec\x86\xed\xd8\x30\x50\xa9\x9b\x81\xd2\x80\x95\x02\xf3\xf9\
\x49\x27\x74\xb0\x15\x68\x00\xea\x76\x97\x3b\x52\xfa\x7b\xc3\x62\
\x47\xce\x33\x11\xe6\xf2\xab\x9c\x31\xce\x8a\xd5\x3c\xa9\x51\xea\
\x42\x6f\x9a\xd8\x5d\xe5\x92\xd2\xb6\x36\xb7\xae\x03\xa9\x89\xe4\
\xfd\xb8\x65\x0b\xef\xc5\x1b\x57\x48\x57\x77\xa6\xda\xa1\xbf\x8e\
\x82\x7b\xa7\x3e\x0c\x42\x1f\x1b\x9f\xc7\x31\xd1\x87\xc1\x06\xff\
\xbc\x6d\xac\x0a\xa2\xde\x7f\xb9\x8d\xab\x01\x1c\x63\x23\x31\xa3\
\xe8\x38\xf6\x98\x2b\xf9\x78\x0c\x29\xe8\x91\x4a\x7c\x8f\x15\x0b\
\xe8\x5e\x3d\x22\x25\x3e\xa1\xc0\x77\xae\xad\x4c\xf4\x37\x4f\xa6\
\xc7\x68\x60\x5c\xba\x40\x44\x27\x26\xab\xce\x55\xa8\x6e\xb3\x7c\
\x60\x2b\x61\x29\x44\x3d\x9b\xd7\xcb\x2d\xb3\x96\xca\xdf\x6c\x9d\
\xa9\xfb\x64\x7f\xfe\x61\x96\xfa\x32\xab\xb7\xdf\x2b\xbe\xcd\xc2\
\x6a\x76\x53\x51\x40\x84\xa4\xb1\x66\xd9\xba\xb6\xed\x27\xbb\x35\
\x75\x5b\x8b\xd4\x99\x47\x61\xf7\xa1\x82\xe3\xf7\x87\x75\x71\x01\
\xf3\x7d\x51\xde\xed\xad\x13\xe5\x9d\xdd\x7e\x45\xdd\x56\x77\xa1\
\xba\xab\x51\x2e\x37\x41\xee\xe0\x8c\xba\x1b\xff\x02\x13\xcc\x10\
\x82\
\x00\x00\x07\x4c\
\x00\
\x00\x29\xd1\x78\x9c\xed\x59\x5b\x8f\xe2\x46\x16\x7e\xef\x5f\xe1\
@ -10081,30 +10099,30 @@ qt_resource_struct = "\
\x00\x00\x00\x86\x00\x00\x00\x00\x00\x01\x00\x00\x3e\x30\
\x00\x00\x01\x70\x00\x00\x00\x00\x00\x01\x00\x01\x08\x08\
\x00\x00\x00\x38\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
\x00\x00\x05\x12\x00\x01\x00\x00\x00\x01\x00\x02\x2f\xb8\
\x00\x00\x04\x1e\x00\x00\x00\x00\x00\x01\x00\x01\xf1\xe9\
\x00\x00\x02\xfc\x00\x00\x00\x00\x00\x01\x00\x01\xa3\x77\
\x00\x00\x05\xb2\x00\x01\x00\x00\x00\x01\x00\x02\x5b\x4a\
\x00\x00\x04\xe4\x00\x01\x00\x00\x00\x01\x00\x02\x28\xe6\
\x00\x00\x03\x36\x00\x01\x00\x00\x00\x01\x00\x01\xb1\xe6\
\x00\x00\x03\x88\x00\x01\x00\x00\x00\x01\x00\x01\xc5\x6d\
\x00\x00\x02\xa0\x00\x01\x00\x00\x00\x01\x00\x01\x88\xd7\
\x00\x00\x04\x5e\x00\x00\x00\x00\x00\x01\x00\x02\x0b\xc3\
\x00\x00\x02\x7e\x00\x01\x00\x00\x00\x01\x00\x01\x7f\xde\
\x00\x00\x03\x64\x00\x01\x00\x00\x00\x01\x00\x01\xbb\x3e\
\x00\x00\x02\x34\x00\x01\x00\x00\x00\x01\x00\x01\x6f\x36\
\x00\x00\x02\x5e\x00\x01\x00\x00\x00\x01\x00\x01\x78\xde\
\x00\x00\x04\x8e\x00\x01\x00\x00\x00\x01\x00\x02\x1b\x31\
\x00\x00\x03\xf4\x00\x00\x00\x00\x00\x01\x00\x01\xe1\x68\
\x00\x00\x04\xbc\x00\x01\x00\x00\x00\x01\x00\x02\x20\x81\
\x00\x00\x05\x3c\x00\x00\x00\x00\x00\x01\x00\x02\x36\x93\
\x00\x00\x03\xac\x00\x01\x00\x00\x00\x01\x00\x01\xca\x84\
\x00\x00\x05\x86\x00\x01\x00\x00\x00\x01\x00\x02\x52\xd0\
\x00\x00\x05\x66\x00\x01\x00\x00\x00\x01\x00\x02\x48\x96\
\x00\x00\x04\x3e\x00\x01\x00\x00\x00\x01\x00\x02\x05\xab\
\x00\x00\x02\xd2\x00\x00\x00\x00\x00\x01\x00\x01\x91\x19\
\x00\x00\x03\xd6\x00\x00\x00\x00\x00\x01\x00\x01\xd2\x6c\
\x00\x00\x02\x00\x00\x01\x00\x00\x00\x01\x00\x01\x67\xe6\
\x00\x00\x05\x12\x00\x01\x00\x00\x00\x01\x00\x02\x30\xce\
\x00\x00\x04\x1e\x00\x00\x00\x00\x00\x01\x00\x01\xf2\xff\
\x00\x00\x02\xfc\x00\x00\x00\x00\x00\x01\x00\x01\xa4\x8d\
\x00\x00\x05\xb2\x00\x01\x00\x00\x00\x01\x00\x02\x5c\x60\
\x00\x00\x04\xe4\x00\x01\x00\x00\x00\x01\x00\x02\x29\xfc\
\x00\x00\x03\x36\x00\x01\x00\x00\x00\x01\x00\x01\xb2\xfc\
\x00\x00\x03\x88\x00\x01\x00\x00\x00\x01\x00\x01\xc6\x83\
\x00\x00\x02\xa0\x00\x01\x00\x00\x00\x01\x00\x01\x89\xed\
\x00\x00\x04\x5e\x00\x00\x00\x00\x00\x01\x00\x02\x0c\xd9\
\x00\x00\x02\x7e\x00\x01\x00\x00\x00\x01\x00\x01\x80\xf4\
\x00\x00\x03\x64\x00\x01\x00\x00\x00\x01\x00\x01\xbc\x54\
\x00\x00\x02\x34\x00\x01\x00\x00\x00\x01\x00\x01\x70\x4c\
\x00\x00\x02\x5e\x00\x01\x00\x00\x00\x01\x00\x01\x79\xf4\
\x00\x00\x04\x8e\x00\x01\x00\x00\x00\x01\x00\x02\x1c\x47\
\x00\x00\x03\xf4\x00\x00\x00\x00\x00\x01\x00\x01\xe2\x7e\
\x00\x00\x04\xbc\x00\x01\x00\x00\x00\x01\x00\x02\x21\x97\
\x00\x00\x05\x3c\x00\x00\x00\x00\x00\x01\x00\x02\x37\xa9\
\x00\x00\x03\xac\x00\x01\x00\x00\x00\x01\x00\x01\xcb\x9a\
\x00\x00\x05\x86\x00\x01\x00\x00\x00\x01\x00\x02\x53\xe6\
\x00\x00\x05\x66\x00\x01\x00\x00\x00\x01\x00\x02\x49\xac\
\x00\x00\x04\x3e\x00\x01\x00\x00\x00\x01\x00\x02\x06\xc1\
\x00\x00\x02\xd2\x00\x00\x00\x00\x00\x01\x00\x01\x92\x2f\
\x00\x00\x03\xd6\x00\x00\x00\x00\x00\x01\x00\x01\xd3\x82\
\x00\x00\x02\x00\x00\x01\x00\x00\x00\x01\x00\x01\x68\xfc\
\x00\x00\x01\xd8\x00\x01\x00\x00\x00\x01\x00\x01\x61\x46\
"

View File

@ -164,14 +164,7 @@ p, li { white-space: pre-wrap; }
<item>
<widget class="Gui::PrefFileChooser" name="gui::preffilechooser">
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;For the IFC reader to function, you need an IFC Schema Express file (.exp) &lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;available &lt;a href=&quot;http://www.steptools.com/support/stdev_docs/express/ifc2x3/ifc2x3_tc1.exp&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#508ed8;&quot;&gt;here. &lt;/span&gt;&lt;/a&gt;For licensing reasons we are not allowed to ship that file &lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;with FreeCAD, so you must download it yourself. Place that file in some&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;location on your computer, and select the file here.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>For the IFC reader to function, you need an IFC Schema Express file (.exp). For licensing reasons we are not allowed to ship that file with FreeCAD, so you must download it yourself. Place that file in some location on your computer, and select the file here.</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>IfcSchema</cstring>
@ -186,9 +179,18 @@ p, li { white-space: pre-wrap; }
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_5">
<widget class="Gui::PrefCheckBox" name="gui::prefcheckbox">
<property name="toolTip">
<string>If this is checked, ifcopenshell will be used to create meshes instead of Arch objects</string>
</property>
<property name="text">
<string>Path to IfcOpenShell</string>
<string>Use IfcOpenShell</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>useIfcOpenShell</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
@ -205,8 +207,24 @@ p, li { white-space: pre-wrap; }
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Path to IfcOpenShell</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefFileChooser" name="gui::preffilechooser_2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>If you have ifcopenshell installed, specify here the path to IfcImport.py</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>ifcopenshell</cstring>
</property>
@ -258,7 +276,45 @@ p, li { white-space: pre-wrap; }
<extends>Gui::ColorButton</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefCheckBox</class>
<extends>QCheckBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
<connections>
<connection>
<sender>gui::prefcheckbox</sender>
<signal>toggled(bool)</signal>
<receiver>label_5</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>79</x>
<y>191</y>
</hint>
<hint type="destinationlabel">
<x>376</x>
<y>192</y>
</hint>
</hints>
</connection>
<connection>
<sender>gui::prefcheckbox</sender>
<signal>toggled(bool)</signal>
<receiver>gui::preffilechooser_2</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>61</x>
<y>191</y>
</hint>
<hint type="destinationlabel">
<x>465</x>
<y>201</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -36,7 +36,12 @@ def open(filename):
doc = FreeCAD.newDocument(docname)
doc.Label = decode(docname)
FreeCAD.ActiveDocument = doc
read(filename)
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
p = p.GetBool("useIfcOpenShell")
if p:
readOpenShell(filename)
else:
read(filename)
return doc
def decode(name):
@ -78,10 +83,39 @@ def getIfcOpenShell():
print "Couldn't import IfcOpenShell"
def readOpenShell(filename):
import Mesh
getIfcOpenShell()
if IfcOpenShell:
IfcOpenShell.Init(filename)
return IfcOpenShell.Get()
while True:
obj = IfcOpenShell.Get()
print "parsing ",obj.guid,": ",obj.name," of type ",obj.type
meshdata = []
n = obj.name
if not n: n = "Unnamed"
f = obj.mesh.faces
v = obj.mesh.verts
m = obj.matrix
print "verts: ",len(v)," faces: ",len(f)
mat = FreeCAD.Matrix(m[0], m[1], m[2], 0,
m[3], m[4], m[5], 0,
m[6], m[7], m[8], 0,
m[9], m[10], m[11], 1)
for i in range(0, len(f), 3):
print "face ",f[i],f[i+1],f[i+2]
face = []
print "i:",i
for j in range(3):
vi = f[i+j]*3
print "vi:",vi
face.append([v[vi],v[vi+1],v[vi+2]])
meshdata.append(face)
newmesh = Mesh.Mesh(meshdata)
mobj = FreeCAD.ActiveDocument.addObject("Mesh::Feature",n)
mobj.Mesh = newmesh
mobj.Placement = FreeCAD.Placement(mat)
if not IfcOpenShell.Next():
break
return None
def read(filename):