Merge branch 'master' into HEAD

git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5393 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
jriegel 2012-01-08 08:50:45 +00:00
commit 99400671f5
6 changed files with 413 additions and 169 deletions

View File

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

View File

@ -2,7 +2,7 @@
# Resource object code # Resource object code
# #
# Created: Tue Jan 3 20:45:25 2012 # Created: Fri Jan 6 18:11:49 2012
# by: The Resource Compiler for PyQt (Qt v4.7.3) # by: The Resource Compiler for PyQt (Qt v4.7.3)
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -5697,111 +5697,132 @@ qt_resource_data = "\
\x00\x00\x00\x12\x00\x57\x00\x65\x00\x72\x00\x6b\x00\x7a\x00\x65\ \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\ \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\ \x54\x6f\x6f\x6c\x73\x07\x00\x00\x00\x04\x61\x72\x63\x68\x01\
\x00\x00\x06\x65\ \x00\x00\x07\xb2\
\x00\ \x00\
\x00\x22\x4d\x78\x9c\xed\x5a\x6d\x6f\xdb\x36\x10\xfe\x9e\x5f\xc1\ \x00\x28\x75\x78\x9c\xed\x5a\xeb\x73\xd3\x38\x10\xff\xde\xbf\x42\
\x79\x40\xbb\x01\xb1\x69\xe7\xad\x89\x22\xbb\x68\x9d\xa4\x29\x90\ \x97\x9b\xe1\x31\xd3\x44\x49\xdb\x94\x36\x75\x7d\x03\x7d\x40\x67\
\x6e\x69\xe3\xb6\xd8\xa7\x40\x96\x68\x8b\x1d\x25\x2a\x24\x55\xd9\ \xe0\x28\xb4\xc0\xdc\x27\xc6\xb1\x95\x58\x20\x5b\xc6\x92\x49\xc2\
\x1d\xf6\xdf\x77\xa4\x28\x5b\xb2\x1c\x27\x8d\xbd\xb6\x1b\x52\xa4\ \xcd\xfd\xef\xb7\x7a\x38\x7e\xa5\xe9\x23\xa1\x1c\x37\xcc\x14\x6a\
\x88\xc8\xa3\xee\x1e\x3e\x77\xbc\x3b\x49\x71\x9f\x4f\x22\x86\x3e\ \x69\xa5\xdd\xd5\x4f\xab\xdf\xae\x5c\x3b\x7f\x4c\x23\x86\xbe\x92\
\x13\x21\x29\x8f\xbb\x8d\x4e\xab\xdd\x40\x24\xf6\x79\x40\xe3\x71\ \x54\x50\x1e\x1f\xb6\x7a\x9d\x6e\x0b\x91\xd8\xe7\x01\x8d\xc7\x87\
\xb7\xf1\x7e\x70\xd6\x3c\x6c\x3c\xef\x6d\xb9\x29\x9d\x2f\xda\x83\ \xad\x77\x97\xa7\xed\xbd\xd6\x1f\xee\x86\x93\xd1\x62\xd0\x0e\x0c\
\x45\xbd\x2d\xe4\xfa\xcc\x93\xb2\xf7\x2a\xa5\x8e\x73\x42\x3d\xc6\ \x72\x37\x90\xe3\x33\x4f\x08\xf7\x79\x46\x07\x83\x63\xea\x31\x3e\
\xc7\xf0\x9b\x8d\xaf\x88\x52\x70\xb3\x7c\x21\xfc\xd0\xc5\xf9\x1a\ \x86\xdf\x6c\x7c\x41\xa4\x84\xc9\xe2\x69\xea\x87\x0e\x36\x63\x60\
\x58\x9c\xd1\x60\x4c\x14\x32\xe3\x6e\xe3\xed\x47\x33\x6c\xa0\xd8\ \xf0\x84\x06\x63\x22\x91\x6e\x1f\xb6\xde\x7c\xd0\xcd\x16\x8a\xbd\
\x8b\x48\xb7\xb1\x4a\x87\x36\x85\xdc\x44\xf0\x84\x08\x35\xb5\x37\ \x88\x1c\xb6\x96\xe9\x50\xa6\x90\x93\xa4\x3c\x21\xa9\x9c\xd9\x09\
\x8c\x09\x8f\x88\x12\x53\x23\x44\xae\x20\xbe\x32\x57\xc8\x9d\xf4\ \x63\xc2\x23\x22\xd3\x99\x16\x22\x27\x25\xbe\xd4\x4f\xc8\x99\xba\
\xda\x2e\x9e\xd8\xc1\x54\x0f\xa6\x76\x00\x08\x54\xd8\xdb\x7f\xb6\ \x5d\x07\x4f\x6d\x63\xa6\x1a\x33\xdb\x00\x0f\x64\xe8\xf6\x9f\xf4\
\xef\xe2\xfc\x32\x9f\x0e\x09\x1d\x87\xaa\x77\xb0\x73\xe4\x62\x7b\ \x1d\x6c\x1e\x4d\x77\x48\xe8\x38\x94\xee\xee\xd6\xbe\x83\xed\xb3\
\x6d\x74\xe2\x42\xa9\x8b\x0b\xe3\xcb\x90\x64\x34\x0e\x78\x36\xa0\ \xd6\x89\x73\xa5\x0e\xce\x8d\x2f\xf2\x64\x42\xe3\x80\x4f\x2e\xa9\
\x8a\x11\x0b\x46\x2a\x01\xd8\x7b\xaf\x48\x4c\x84\xc7\x90\xb4\x7b\ \x64\xc4\x3a\x23\x64\x0a\xbe\xbb\xcf\x49\x4c\x52\x8f\x21\x61\xd7\
\x71\xb1\x15\xd4\x55\x32\x6f\xca\xd3\x39\x37\x1f\x5e\xf2\xc9\x85\ \xe2\x60\x2b\x68\xaa\x64\xde\x8c\x67\x05\x36\xef\x9f\xf1\xe9\x4b\
\x99\xb2\x1a\x17\x4c\xca\xc4\xf3\x41\x51\xc3\x6e\x20\x4e\xa3\x21\ \xdd\x65\x35\xd6\x4c\x8a\xc4\xf3\x41\x51\xcb\x2e\x20\xce\xa2\x21\
\x11\xbd\x03\x17\xdb\xab\x1c\x7e\xd9\x42\x4d\x45\xe4\x89\x31\x8d\ \x49\xdd\x5d\x07\xdb\x27\xe3\x7e\xd9\x42\x43\x45\xe4\xa5\x63\x1a\
\x17\x34\x1c\xad\xd4\x40\x15\x89\xe6\x4c\x96\x7d\xf9\x4a\xf0\x34\ \xd7\x34\xec\x2f\xd5\x40\x25\x89\x0a\x24\xcb\x7b\xf9\x3c\xe5\x59\
\x01\xcc\x85\x37\xc7\xc5\x38\x5f\x5e\x33\xae\xe6\x64\x2d\xe1\x4b\ \x02\x3e\xe7\xbb\x39\xce\xdb\x66\x78\xc3\xb8\x2c\xc0\x5a\x80\x97\
\xfb\x1c\x5d\x2d\x21\xad\x8e\x69\x25\x75\xd6\x18\x44\xad\xa2\xbe\ \xda\x73\x74\xb1\x00\xb4\xa6\x4f\x4b\xa1\xb3\xc6\x20\x6a\x25\xf5\
\xc7\xf2\xd9\xeb\x9d\xb9\xdd\xf9\x86\x96\x28\x3a\xaf\x29\x0a\xb9\ \x3d\x66\x7a\x3f\x6e\x15\x76\x8b\x05\x2d\x50\xf4\xa2\xa1\x28\xe4\
\xa0\x5f\x78\xac\x96\xa8\x5a\x54\x56\xa7\xe8\xc2\x1b\x12\x56\x68\ \x29\xfd\xc6\x63\xb9\x40\x55\x5d\x59\x13\xa2\x97\xde\x90\xb0\x5c\
\x62\x7a\x50\xb9\x7d\x09\x47\x64\xa2\x2a\x0b\x66\x3c\x9d\x90\x91\ \x13\x53\x8d\xca\xf4\x05\x18\x91\xa9\xac\x0c\x98\xe3\x74\x4c\x46\
\x97\x32\x50\xcd\x19\x17\x68\x04\xff\x33\x8f\xb1\x45\xa6\x96\xd3\ \x5e\xc6\x40\x35\x67\x3c\x45\x23\xf8\x37\xf1\x18\xab\x23\xb5\x18\
\x95\x4f\xe6\xd8\x4a\xe0\x71\x15\x7d\x6d\x33\x3a\xe0\x88\xa8\xf1\ \x2e\xd3\x69\x7c\x2b\x39\x8f\xab\xde\x37\x16\xa3\x02\x8e\xa4\x0d\
\x70\x65\xa6\x57\x6e\x03\xd6\x12\x58\xaa\x20\x6f\x2c\xec\x86\x40\ \x1c\x2e\x74\xf7\xd2\x65\xc0\x58\x02\x43\x25\xf0\x46\x6d\x35\x04\
\xa8\xf5\xde\x2a\xc7\x39\x9f\xe9\x73\xb1\x99\xbc\x6b\x03\xf5\xf3\ \x42\xcd\x7d\x23\x07\x83\x17\x73\x7d\x0e\xd6\x9d\xd7\x2d\xa0\x79\
\x40\xbf\x90\x73\x1a\x83\xa7\xa4\x0a\xe0\xb8\x75\x1b\xed\x45\xea\ \x1e\xe8\x37\xf2\x82\xc6\xb0\x53\x42\x06\x70\xdc\x0e\x5b\xdd\x3a\
\x60\x45\x65\xa6\xc8\x06\x7b\xed\x4a\x32\x98\x49\x6d\x22\xd8\x69\ \x74\x30\xa2\xd2\x93\xb3\xc1\x4e\xb7\x42\x06\x73\xa9\x25\x82\xad\
\x57\x72\xc2\x1c\xd6\xa2\xc2\x5b\x98\xce\x89\xfb\x0a\xa6\xab\x61\ \x6e\x85\x13\x0a\xb7\xea\x0a\xaf\x40\xda\x00\x77\x0b\xa4\xab\x61\
\x63\xd2\xe2\xa5\x20\xa3\xbe\xf6\xf5\xcb\x54\x29\xa0\xb1\x38\x64\ \xa3\x69\xf1\x3c\x25\xa3\x23\xb5\xd7\xcf\x32\x29\x01\xc6\xfc\x90\
\x5a\x96\x80\xcc\xc4\xc1\x30\x97\xad\x8c\x28\xce\xd9\x80\x26\xcb\ \x29\x59\x02\x32\x1d\x07\x43\x23\x5b\x1a\x51\x9c\xb3\x4b\x9a\x2c\
\x83\x6a\x10\x52\x89\xe0\x47\x85\x04\x05\xb5\x00\x8b\x49\x86\x3e\ \x0e\xaa\xcb\x90\x0a\x04\x3f\x32\x24\x28\x68\x04\x58\x4c\x26\xe8\
\x42\x90\x21\x3e\xfc\x04\x49\xf1\xfe\xb1\x56\x03\x61\x74\x2e\x40\ \x03\x04\x19\xe2\xc3\x4f\x40\x8a\x37\x8f\xb5\x86\x13\x5a\x67\xcd\
\x30\x73\x0b\xfc\x0b\x12\xf4\x76\xf6\xf7\x75\x12\x0e\x16\x44\x63\ \x05\xdd\x57\xc3\x3f\x25\x81\xbb\xd5\xef\x2b\x12\x0e\x6a\xa2\x71\
\x41\x48\xdc\xeb\x1c\x81\x6b\xf2\xcb\xaa\x78\xc8\x52\xd2\xeb\x3c\ \x4a\x48\xec\xf6\xf6\x61\x6b\xcc\x63\x55\x3c\x64\x19\x71\x7b\x4f\
\x03\xa9\xb9\xaa\xba\xad\x66\xea\x7e\xa8\x35\xcd\xa7\xb1\x2e\x37\ \x40\xaa\x9f\xaa\xdb\xd6\x30\x75\x33\xaf\x15\xcc\x27\xb1\x4a\x37\
\xb7\x46\x98\x6f\x19\xd1\x34\x19\x6f\x81\xb1\x87\x92\xa4\xcd\x5d\ \x57\x46\x98\x6f\x11\x51\x30\xe9\xdd\x02\x63\x77\x05\x49\x99\x3b\
\x7a\x2a\xbc\xdb\xda\x1b\x1e\x60\x5b\x67\x37\x75\xfa\x5d\x9c\x67\ \xf7\x64\x78\xbd\xb5\x57\x3c\xc0\x36\xcf\xae\xeb\xf4\x3b\xd8\x30\
\xc2\x59\x9a\xac\x88\xd7\x4d\x9a\x6b\xa5\xcc\x8d\x25\x4c\x10\xa4\ \xe1\x9c\x26\x2b\xe2\x55\x49\x73\x25\xca\x5c\x1b\x61\x82\x20\xf3\
\xbe\x4a\x05\xf9\x7e\x59\xf3\x8e\xf4\xff\x98\x37\xbf\x65\xde\xbc\ \x65\x96\x92\x1f\xc7\x9a\xd7\xd0\xff\x2f\xde\xbc\x4f\xde\xbc\x2e\
\xab\x16\xaf\x97\x39\xaf\x8a\x68\xfb\xb6\xe9\xb3\xb3\xdf\x5e\x91\ \x17\xaf\xc6\x9c\x17\x79\xb4\xdd\x2f\x7d\xf6\xfa\xdd\x25\xf4\xb9\
\x3e\x0f\x8e\x56\xa5\xcf\xc3\x83\xef\x94\x3e\x67\x5c\xfd\x7f\x73\ \xbb\xbf\x8c\x3e\xf7\x76\x7f\x10\x7d\xce\xb1\xfa\xff\x72\x68\x55\
\x68\x55\x58\xd1\x55\x5a\xf7\x80\x76\x7b\x1e\xc5\xf7\x6b\xb8\x5f\ \x58\xd1\x55\x1a\x77\x87\x72\xbb\x88\xe2\x9b\x15\xdc\x67\xa7\x47\
\x9f\xf5\x11\x8d\x12\x2e\xd4\xa6\xbb\xec\xcd\xf5\xd8\xbb\xeb\xf5\ \x88\x46\x09\x4f\xe5\xba\xab\xec\xf5\xd5\xd8\xdb\xab\xd5\xd8\xdb\
\xd8\xbb\x0f\x2c\x19\x4f\x98\x3a\xfe\xe9\xe4\xf7\xfe\xe0\x8f\xcb\ \x77\x4c\x19\x0f\x98\x3c\xf8\xed\xf8\xf5\xd1\xe5\x5f\xe7\x27\xe8\
\x53\x74\x3e\x78\x73\x81\x2e\xdf\xbf\xbc\x78\xdd\x47\x4f\x6e\x52\ \xc5\xe5\xab\x97\xe8\xfc\xdd\xb3\x97\x67\x47\xe8\xc1\x97\x8c\xcb\
\xae\x8e\x9b\x18\x7f\xdc\xed\x63\x7c\x32\x38\xc9\xa5\xf0\x44\x8c\ \x83\x36\xc6\x1f\xb6\x8f\x30\x3e\xbe\x3c\x36\x52\xb8\x11\x63\x7c\
\xf1\xe9\x6f\xb9\xd4\x2e\x0a\x95\x4a\x1c\x8c\xb3\x2c\x6b\x65\xbb\ \xf2\xa7\x91\xda\x41\xa1\x94\xc9\x00\xe3\xc9\x64\xd2\x99\x6c\x77\
\x2d\x2e\xc6\x78\xf0\x0e\xbf\x3b\xed\x37\x43\x15\xb1\xbd\xb6\xa1\ \x78\x3a\xc6\x97\x6f\xf1\xdb\x93\xa3\x76\x28\x23\xb6\xd3\xd5\x90\
\xdc\x57\xad\x40\x05\xf9\xfa\x27\x63\x75\xbc\xa5\x0d\x6b\xb9\x1e\ \xfb\xb2\x13\xc8\xc0\x8c\x7f\x30\x96\x07\x1b\xca\xb0\x92\xab\x86\
\x98\x6b\xe2\x05\xc5\x35\x3c\xf0\x7a\x39\xf2\xfc\x86\x1b\xb8\x3f\ \x7e\x26\x5e\x90\x3f\xc3\x85\xd7\x33\x9e\x9b\x09\x5f\x60\x7e\xa8\
\xd4\x7b\xb0\x66\x7d\x20\x0e\x8a\x86\x95\x76\xec\x2c\x2e\x6e\x97\ \xd6\x60\xcd\xfa\x00\x1c\x24\x0d\x2b\xed\xd9\x5e\x9c\x4f\x17\x72\
\x6a\xca\x08\x52\xd3\xa4\xb8\x5f\xdf\x0a\x31\x2f\x4b\xe6\x93\x6d\ \xc6\x08\x92\xb3\x24\x9f\xaf\xa6\x42\xcc\x8b\x92\xf9\x64\x13\x31\
\xc4\x28\xfa\x0b\x65\x21\x70\xdd\x34\x59\xd8\x41\x70\x94\x9a\x99\ \x8a\xfe\x46\x93\x10\xb0\x6e\x6b\x16\x1e\x20\x38\x4a\xed\x49\xea\
\xf0\x92\x63\xf4\xb7\xc1\x87\x8d\xa6\x42\x2d\x2e\x43\x1c\xf2\x60\ \x25\x07\xe8\x1f\xed\x1f\xd6\x9a\x72\xb5\xb8\xec\xe2\x90\x07\x33\
\x8a\x8c\xd8\xda\x80\x24\x18\xab\xe6\xc8\x8b\x28\x9b\x3a\x4f\x4f\ \xa4\xc5\xd6\x06\x90\x60\x2c\xdb\x23\x2f\xa2\x6c\x36\x78\x78\x4c\
\xc8\x27\xef\x43\x8a\xae\xbc\x58\x3e\xb5\x22\x5d\x10\x9c\xc3\xa4\ \x3e\x79\xef\x33\x74\xe1\xc5\xe2\xa1\x15\xa9\x84\x30\xd8\x4b\xf2\
\x58\x99\x99\xa2\xe1\xec\xb5\xdb\x85\x5c\x2b\x73\x62\x2e\x22\x8f\ \x91\x13\x9d\x34\x06\x3b\xdd\x6e\x2e\x57\xca\x06\x31\x4f\x23\x8f\
\x1d\x2f\x10\x95\x54\x4d\xe5\xcf\xb4\x4d\xc5\x13\xa7\x9d\x4c\x66\ \x1d\xd4\x80\x4a\xaa\xa6\xcc\x9d\xb6\x2d\x79\x32\xe8\x26\xd3\x79\
\xe3\x21\x87\x14\x1f\x55\xa6\x18\x19\xa9\xca\x84\x30\x56\xcd\x4c\ \x7b\xc8\x81\xe2\xa3\x4a\x17\x23\x23\x59\xe9\x48\xb5\x55\xdd\xd3\
\xf3\x46\x35\x87\x8c\xfb\x7f\x36\xe1\xc1\x1e\xe8\x74\x00\x89\x66\ \xfe\x22\xdb\x43\xc6\xfd\xcf\x6d\xb8\xd8\x03\x9c\x03\xf0\x44\x21\
\x6a\x36\x84\x45\x73\x1c\x67\x90\xe3\x75\xe6\xd7\x67\x49\x00\x11\ \x35\x6f\xc2\xa0\xc2\x8f\x53\xe0\x78\xc5\xfc\xea\x2c\xa5\x00\x04\
\x50\xef\x15\x47\xa3\x34\xf6\x75\xe9\xde\x46\x10\xc4\x50\x03\x48\ \xe4\x7b\xc9\xd1\x28\x8b\x7d\x95\xba\x37\x11\x04\x31\xe4\x00\x12\
\x80\xbc\xd8\xac\xb9\xf2\x43\x12\x79\xe8\x74\x02\xa4\x4a\x89\x46\ \x20\x2f\xd6\x63\x2e\xfc\x90\x44\x1e\x3a\x99\x02\xa8\x42\xa0\x11\
\x14\x5c\xf2\x4b\x8b\x4c\x92\x5f\x91\xf7\xd9\xa3\x10\xb5\x30\x11\ \x85\x2d\x79\xd4\x21\xd3\xe4\x31\xf2\xbe\x7a\x14\xa2\x16\x3a\x42\
\x12\x41\x1c\xc3\x6d\xf2\x23\xed\x55\xc3\xf0\x50\x08\x89\xb5\x5b\ \x92\x92\x81\xc6\x36\xf9\x2f\xad\x55\xb9\xe1\xa1\x10\x88\xf5\xb0\
\x8b\x70\xa9\x48\xa2\xcb\xa4\x6c\xf9\x3c\xc2\x32\x4d\x74\x5a\x81\ \x11\xe1\x42\x92\x44\xa5\x49\xd1\xf1\x79\x84\x45\x96\x28\x5a\x81\
\x40\x09\xc8\xe7\xeb\x80\xfb\x12\x93\x7c\xc7\x98\x8e\xfc\x9d\xc9\ \x40\x09\xc8\xd7\x8f\x01\xf7\x05\x26\x66\xc5\x98\x8e\xfc\xad\xe9\
\xae\xfd\x75\xad\xfc\x8e\xde\x7c\xd5\x06\x84\x5d\x5c\xdd\xad\xc1\ \xb6\xfd\xf5\x51\xfa\x3d\xb5\xf8\xaa\x0d\x08\xbb\xb8\xba\x5a\xed\
\x14\x10\x9f\x0b\xd3\x11\x39\x28\x05\x7c\x82\xd1\x98\x1c\xe7\xb5\ \x53\x40\x7c\x9e\xea\x8a\x68\x80\x32\xf0\x2f\x65\x34\x26\x07\x26\
\xd6\xf9\x79\xbf\x7d\x48\x82\xc3\x12\xda\xcd\x81\x33\x21\x0f\x98\ \xd7\x0e\x7e\xef\x77\xf7\x48\xb0\x57\xf2\x76\x7d\xce\xe9\x90\x07\
\x66\x11\xef\xcd\xae\x92\xd9\x95\x8e\xfc\xf9\x91\xb0\x27\x78\x73\ \x9f\xe6\x11\xef\xcd\x9f\x92\xf9\x93\x8a\xfc\xe2\x48\xd8\x13\xbc\
\xdd\xe5\xbf\xdb\x95\x5f\xef\xad\x97\x66\xf7\x1e\x98\x66\x4b\x27\ \xbe\xea\xf2\xfb\x56\xe5\x1f\x77\x56\xa3\xd9\x9d\x3b\xd2\x6c\xe9\
\xc2\x9c\x04\x08\x45\xe3\xe0\xef\xd7\x95\xaf\x2e\x18\x8f\x5d\xf9\ \x44\xe8\x93\x00\xa1\xa8\x37\xf8\xc7\x55\xe5\xcb\x13\xc6\xaf\xaa\
\x46\xba\xf2\x33\xf0\x75\x3f\xe4\x5c\x12\x51\xeb\xca\x75\x1c\xf8\ \x7c\x2d\x55\xf9\x29\xec\xf5\x51\xc8\xb9\x20\x69\xa3\x2a\x57\x71\
\x56\xf6\xe0\x9e\xfc\xb1\x7c\x3f\x96\xef\x6f\x5d\xbe\x97\xfc\xfb\ \xe0\x5b\xd9\x9d\x6b\xf2\xf5\xb1\x72\x07\x29\x5d\x8c\xfa\x24\x16\
\xf1\x4a\xf8\xbc\xc7\xf8\x8f\x15\x73\xe8\x88\x5a\xe8\x96\x4a\xac\ \xa0\x59\x69\x13\x3c\x16\x68\x42\x90\x07\x05\x7d\xcc\x25\x82\x0b\
\x9d\xc8\xa8\x4f\x62\x09\x67\x5f\xbb\x51\xf2\x58\xa2\x8c\x20\x0f\ \x3f\x9f\x80\x2e\xb0\x20\x42\x9a\x80\x61\x4f\x1a\x15\x13\x2a\x43\
\x1e\xb9\x63\xae\x90\xc7\x18\xcf\xc0\x89\xe0\x5a\x19\xd2\x04\x3c\ \x74\x0a\x45\xf6\xd1\xd3\xe3\x4d\x24\xb8\xb6\x1b\x65\x42\xa2\x80\
\xee\xa9\xdc\x77\x3f\x9e\x87\x32\xaa\x42\x74\x06\x0f\xe6\xfd\x17\ \x4f\x62\xc6\xbd\x00\x51\xa9\x3a\x53\x41\xd8\xa8\x83\xce\x19\xe0\
\x27\xdb\x48\x72\x13\x82\x51\x2a\x15\x0a\x78\x16\x33\xee\x05\x88\ \x5b\x9a\x4f\x81\x06\x79\x54\x1c\x0b\x04\x3f\x6a\x34\x70\x5e\x94\
\x2a\x3d\x29\x24\x61\xa3\x16\xba\x64\x70\xc8\x4b\x3b\xa2\xc0\x36\ \x64\x92\xa4\x9b\xb0\x80\x00\xc1\x64\xb8\x55\xe8\x05\xeb\x69\x2a\
\x8f\xc8\x8f\xb7\xb1\xa2\xb6\x23\xf8\xd1\xf0\xc1\xd7\x51\x92\x2a\ \x7d\x74\xee\x7e\xc7\xb8\x45\xb5\x7e\x36\xf2\x0d\x74\xff\xcb\x42\
\x22\xb6\xe1\x70\x05\x08\x76\x43\x7c\x65\x0e\xa3\xd9\x87\xf1\xf8\ \x7d\x75\x5a\xed\xdf\x9c\x56\x8b\x2b\x6b\x48\xfc\xcf\xe5\xea\x7e\
\x46\x7b\xac\x75\x5e\x4b\xbc\x1e\xf9\xf9\xd1\x7f\x7c\x23\x91\xd7\ \x7e\x5f\x55\x82\x61\xf1\x56\xfd\xf6\xc7\xe2\x6c\x04\x41\x62\x6e\
\xd9\x72\x13\x55\x3c\xfb\x57\x3f\x07\xdd\xa7\x77\x9a\xb7\x4d\x1f\ \xab\x5a\x19\x09\x36\x11\xe4\x3a\x50\x10\x8b\x90\x30\x06\x01\x0b\
\xac\x8e\x4a\xd3\x54\x7f\x0f\xf1\x15\xad\x52\xb5\x4b\xb2\x0d\xd2\ \xff\x0d\x09\xca\x84\x89\x67\x1f\xc2\x5d\x12\x14\x11\x10\xc3\xb4\
\x4e\xad\x41\x2a\x7a\xa3\xbd\x5a\x6f\x54\x69\x8b\x16\xa1\x54\x9a\ \x18\x12\x29\xc4\x2c\x1f\x99\x77\xf4\x2b\xdf\x66\xaf\x4e\x0c\xef\
\xa1\x39\x49\x25\x26\x4b\x34\xda\x86\xbc\x78\x3b\x68\x3f\xdf\x76\ \x04\x1c\xde\x91\xff\x1a\x3c\xbb\x50\x9e\xdd\x4b\x34\xc3\xaa\xab\
\x1b\x07\x0d\x7b\xaa\xba\x8d\x4e\xa7\x81\xf5\xca\x84\x4e\x22\x2f\ \x36\x7f\xce\x98\xbe\x6d\xca\x5b\x9e\xbc\x7f\xa5\xbc\x55\x52\xde\
\x29\x0a\x50\xef\xe6\xd2\x8c\xcf\x04\x8f\xde\xd0\x88\x5c\xc1\xb9\ \xa2\x62\xa9\xbf\x14\x6f\x12\xab\x2b\x40\x50\x5b\xfe\x10\x8e\xb5\
\xf1\x09\x60\xa9\xae\xd2\x9f\xe2\x21\x43\xf0\x28\xb7\x28\x0d\x92\ \x3b\xf2\x98\x20\x0e\xd6\xcf\x6b\x3c\x6b\x2a\x50\xd5\x61\xbf\xd3\
\xf2\x4c\x8e\xb2\xf4\xb9\xbe\xd4\x81\xcd\x3f\xd1\x6b\x7f\x4c\xa0\ \x79\xbb\x43\x34\xae\x56\x14\x5c\xf3\xaa\xee\xbb\xc1\x77\x0d\xaf\
\x05\x09\x64\xcf\x7e\x9e\x07\x6f\xd8\x89\xad\x9c\x2a\x5d\x21\xb5\ \xaa\xcc\x1e\x7a\x5f\x49\x95\x4f\x15\x63\x42\x79\xa0\x78\x56\x24\
\x06\xac\x15\xe4\xdf\xeb\x5b\xa1\x8b\xad\xc0\x10\xb0\x68\x77\x35\ \xc4\xa7\xa3\x99\x4e\xce\x3a\x55\x27\x05\xec\x67\xfa\x25\x4c\x27\
\x90\xd2\x0b\xda\xe5\x40\x2e\x53\x19\x16\xf2\xdb\xc0\xe4\x60\xe5\ \x99\xdd\x0b\xcd\x95\x3d\xfc\x59\x39\x6e\xcd\x2f\xd8\x2a\x04\x99\
\x7a\x48\x16\x1a\xd3\xa5\x68\xea\xdc\xdd\x06\x49\x6b\xdb\x18\xac\ \xbf\xca\xaa\xfe\x75\xf3\x26\xbc\x58\x50\xe2\x7b\xab\xa3\x42\x88\
\xbb\x48\xaa\x33\xb9\x3e\xac\xea\x84\xf9\x0b\x0e\x28\xf9\x26\xfe\ \xcd\xd7\x6a\xb7\xa0\xc1\x2a\x03\x5a\xf2\xdb\x6a\x90\x5f\xce\x7b\
\xa4\x89\x54\x68\x57\x63\x62\xe2\x4f\x8f\x5d\x9c\xd2\xde\xd6\x3f\ \x3b\x0d\xde\xab\x50\x5e\xdd\x95\x0a\xd1\x15\x20\x95\x90\x2c\xc1\
\x48\xb4\x84\x40\ \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\x07\x4c\
\x00\ \x00\
\x00\x29\xd1\x78\x9c\xed\x59\x5b\x8f\xe2\x46\x16\x7e\xef\x5f\xe1\ \x00\x29\xd1\x78\x9c\xed\x59\x5b\x8f\xe2\x46\x16\x7e\xef\x5f\xe1\
@ -10078,30 +10099,30 @@ qt_resource_struct = "\
\x00\x00\x00\x86\x00\x00\x00\x00\x00\x01\x00\x00\x3e\x30\ \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\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\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\x81\ \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\xf1\xb2\ \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\xa3\x40\ \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\x5b\x13\ \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\x28\xaf\ \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\xb1\xaf\ \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\xc5\x36\ \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\x88\xa0\ \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\x0b\x8c\ \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\x7f\xa7\ \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\xbb\x07\ \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\x6e\xff\ \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\x78\xa7\ \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\x1a\xfa\ \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\xe1\x31\ \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\x20\x4a\ \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\x36\x5c\ \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\xca\x4d\ \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\x52\x99\ \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\x48\x5f\ \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\x05\x74\ \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\x90\xe2\ \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\xd2\x35\ \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\x67\xaf\ \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\ \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> <item>
<widget class="Gui::PrefFileChooser" name="gui::preffilechooser"> <widget class="Gui::PrefFileChooser" name="gui::preffilechooser">
<property name="toolTip"> <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; <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>
&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>
</property> </property>
<property name="prefEntry" stdset="0"> <property name="prefEntry" stdset="0">
<cstring>IfcSchema</cstring> <cstring>IfcSchema</cstring>
@ -183,6 +176,65 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<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>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>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</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>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -224,7 +276,45 @@ p, li { white-space: pre-wrap; }
<extends>Gui::ColorButton</extends> <extends>Gui::ColorButton</extends>
<header>Gui/PrefWidgets.h</header> <header>Gui/PrefWidgets.h</header>
</customwidget> </customwidget>
<customwidget>
<class>Gui::PrefCheckBox</class>
<extends>QCheckBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
</customwidgets> </customwidgets>
<resources/> <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> </ui>

View File

@ -21,7 +21,7 @@
#* * #* *
#*************************************************************************** #***************************************************************************
import ifcReader, FreeCAD, Arch, Draft, os, time import ifcReader, FreeCAD, Arch, Draft, os, sys, time
from draftlibs import fcvec from draftlibs import fcvec
__title__="FreeCAD IFC importer" __title__="FreeCAD IFC importer"
@ -36,6 +36,11 @@ def open(filename):
doc = FreeCAD.newDocument(docname) doc = FreeCAD.newDocument(docname)
doc.Label = decode(docname) doc.Label = decode(docname)
FreeCAD.ActiveDocument = doc FreeCAD.ActiveDocument = doc
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
p = p.GetBool("useIfcOpenShell")
if p:
readOpenShell(filename)
else:
read(filename) read(filename)
return doc return doc
@ -52,6 +57,7 @@ def decode(name):
return decodedName return decodedName
def getSchema(): def getSchema():
"retrieves the express schema"
default = "IFC2X3_TC1.exp" default = "IFC2X3_TC1.exp"
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch") p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
p = p.GetString("IfcSchema") p = p.GetString("IfcSchema")
@ -63,6 +69,55 @@ def getSchema():
return p return p
return None return None
def getIfcOpenShell():
"locates and imports ifcopenshell"
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
p = p.GetString("ifcopenshell")
if p:
try:
sys.path.append(os.path.dirname(p))
global IfcOpenShell
IfcOpenShell = None
import IfcImport as IfcOpenShell
except:
print "Couldn't import IfcOpenShell"
def readOpenShell(filename):
import Mesh
getIfcOpenShell()
if IfcOpenShell:
IfcOpenShell.Init(filename)
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): def read(filename):
"processes an ifc file and add its objects to the given document" "processes an ifc file and add its objects to the given document"
t1 = time.time() t1 = time.time()

View File

@ -273,9 +273,10 @@ def getSelection():
"getSelection(): returns the current FreeCAD selection" "getSelection(): returns the current FreeCAD selection"
return FreeCADGui.Selection.getSelection() return FreeCADGui.Selection.getSelection()
def select(objs): def select(objs=None):
"select(object): deselects everything and selects only the passed object or list" "select(object): deselects everything and selects only the passed object or list"
FreeCADGui.Selection.clearSelection() FreeCADGui.Selection.clearSelection()
if objs:
if not isinstance(objs,list): if not isinstance(objs,list):
objs = [objs] objs = [objs]
for obj in objs: for obj in objs:
@ -1269,10 +1270,10 @@ def makeSketch(objectslist,autoconstraints=False,addTo=None,name="Sketch"):
if closed: if closed:
nobj.addConstraint(Constraint("Coincident",last-1,EndPoint,segs[0],StartPoint)) nobj.addConstraint(Constraint("Coincident",last-1,EndPoint,segs[0],StartPoint))
ok = True ok = True
else: elif obj.isDerivedFrom("Part::Feature"):
if fcgeo.hasOnlyWires(obj.Shape): if fcgeo.hasOnlyWires(obj.Shape):
for w in obj.Shape.Wires: for w in obj.Shape.Wires:
for edge in w.Edges: for edge in fcgeo.sortEdges(w.Edges):
nobj.addGeometry(fcgeo.geom(edge)) nobj.addGeometry(fcgeo.geom(edge))
if autoconstraints: if autoconstraints:
last = nobj.GeometryCount last = nobj.GeometryCount
@ -2354,7 +2355,7 @@ class _Array:
self.createGeometry(obj) self.createGeometry(obj)
def onChanged(self,obj,prop): def onChanged(self,obj,prop):
if prop in ["ArrayType","NumberX","NumberY","NumberPolar","IntervalX","IntervalY","Angle","Center"]: if prop in ["ArrayType","NumberX","NumberY","NumberPolar","IntervalX","IntervalY","Angle","Center","Axis"]:
self.createGeometry(obj) self.createGeometry(obj)
def createGeometry(self,obj): def createGeometry(self,obj):

View File

@ -22,13 +22,12 @@
#*************************************************************************** #***************************************************************************
__title__="FreeCAD Draft Workbench - SVG importer/exporter" __title__="FreeCAD Draft Workbench - SVG importer/exporter"
__author__ = "Yorik van Havre <yorik@gmx.fr>" __author__ = "Yorik van Havre, Sebastian Hoogen"
__url__ = ["http://yorik.orgfree.com","http://free-cad.sourceforge.net"] __url__ = ["http://free-cad.sourceforge.net"]
''' '''
This script imports SVG files in FreeCAD. Currently only reads the following entities: This script imports SVG files in FreeCAD. Currently only reads the following entities:
paths, lines, arcs and rects. paths, lines, arcs and rects.
Bezier curves are skipped.
''' '''
import xml.sax, string, FreeCAD, os, math, re, Draft import xml.sax, string, FreeCAD, os, math, re, Draft
@ -373,13 +372,14 @@ class svgHandler(xml.sax.ContentHandler):
path = [] path = []
point = [] point = []
lastvec = Vector(0,0,0) lastvec = Vector(0,0,0)
lastpole = None
command = None command = None
relative = False relative = False
firstvec = None firstvec = None
pathdata = [] pathdata = []
for d in data['d']: for d in data['d']:
if (len(d) == 1) and (d in ['m','M','l','L','h','H','v','V','a','A','c','C']): if (len(d) == 1) and (d in ['m','M','l','L','h','H','v','V','a','A','c','C','q','Q','s','S','t','T']):
pathdata.append(d) pathdata.append(d)
else: else:
try: try:
@ -453,12 +453,44 @@ class svgHandler(xml.sax.ContentHandler):
command = "close" command = "close"
point = [] point = []
elif (d == "C"): elif (d == "C"):
command = "curve" command = "cubic"
relative = False relative = False
smooth = False
point = [] point = []
elif (d == "c"): elif (d == "c"):
command = "curve" command = "cubic"
relative = True relative = True
smooth = False
point = []
elif (d == "Q"):
command = "quadratic"
relative = False
smooth = False
point = []
elif (d == "q"):
command = "quadratic"
relative = True
smooth = False
point = []
elif (d == "S"):
command = "cubic"
relative = False
smooth = True
point = []
elif (d == "s"):
command = "cubic"
relative = True
smooth = True
point = []
elif (d == "T"):
command = "quadratic"
relative = False
smooth = True
point = []
elif (d == "t"):
command = "quadratic"
relative = True
smooth = True
point = [] point = []
else: else:
try: try:
@ -485,6 +517,7 @@ class svgHandler(xml.sax.ContentHandler):
firstvec = lastvec firstvec = lastvec
print "move ",lastvec print "move ",lastvec
command = "line" command = "line"
lastpole = None
point = [] point = []
elif (len(point)==2) and (command=="line"): elif (len(point)==2) and (command=="line"):
if relative: if relative:
@ -496,6 +529,7 @@ class svgHandler(xml.sax.ContentHandler):
print "line ",lastvec,currentvec print "line ",lastvec,currentvec
lastvec = currentvec lastvec = currentvec
path.append(seg) path.append(seg)
lastpole = None
point = [] point = []
elif (len(point)==1) and (command=="horizontal"): elif (len(point)==1) and (command=="horizontal"):
if relative: if relative:
@ -505,6 +539,7 @@ class svgHandler(xml.sax.ContentHandler):
currentvec = Vector(point[0],lasty,0) currentvec = Vector(point[0],lasty,0)
seg = Part.Line(lastvec,currentvec).toShape() seg = Part.Line(lastvec,currentvec).toShape()
lastvec = currentvec lastvec = currentvec
lastpole = None
path.append(seg) path.append(seg)
point = [] point = []
elif (len(point)==1) and (command=="vertical"): elif (len(point)==1) and (command=="vertical"):
@ -515,6 +550,7 @@ class svgHandler(xml.sax.ContentHandler):
currentvec = Vector(lastx,-point[0],0) currentvec = Vector(lastx,-point[0],0)
seg = Part.Line(lastvec,currentvec).toShape() seg = Part.Line(lastvec,currentvec).toShape()
lastvec = currentvec lastvec = currentvec
lastpole = None
path.append(seg) path.append(seg)
point = [] point = []
elif (len(point)==7) and (command=="arc"): elif (len(point)==7) and (command=="arc"):
@ -539,6 +575,7 @@ class svgHandler(xml.sax.ContentHandler):
midpoint = lastvec.add(chord.add(perp)) midpoint = lastvec.add(chord.add(perp))
seg = Part.Arc(lastvec,midpoint,currentvec).toShape() seg = Part.Arc(lastvec,midpoint,currentvec).toShape()
lastvec = currentvec lastvec = currentvec
lastpole = None
path.append(seg) path.append(seg)
point = [] point = []
elif (command == "close"): elif (command == "close"):
@ -574,12 +611,46 @@ class svgHandler(xml.sax.ContentHandler):
print "straight segment" print "straight segment"
seg = Part.Line(lastvec,currentvec).toShape() seg = Part.Line(lastvec,currentvec).toShape()
else: else:
print "bezier segment" print "cubic bezier segment"
b = Part.BezierCurve() b = Part.BezierCurve()
b.setPoles([lastvec,pole1,pole2,currentvec]) b.setPoles([lastvec,pole1,pole2,currentvec])
seg = b.toShape() seg = b.toShape()
print "connect ",lastvec,currentvec print "connect ",lastvec,currentvec
lastvec = currentvec lastvec = currentvec
lastpole = ('cubic',pole2)
path.append(seg)
point = []
elif (command=="quadratic") and (((smooth==False) and (len(point)==4)) or (smooth==True and (len(point)==2))) :
if smooth:
if relative:
currentvec = lastvec.add(Vector(point[0],-point[1],0))
else:
currentvec = Vector(point[0],-point[1],0)
if lastpole is not None and lastpole[0]=='quadratic':
pole1 = lastvec.sub(lastpole[1]).add(lastvec)
else:
pole1 = lastvec
else: #not smooth
if relative:
currentvec = lastvec.add(Vector(point[2],-point[3],0))
pole1 = lastvec.add(Vector(point[0],-point[1],0))
else:
currentvec = Vector(point[2],-point[3],0)
pole1 = Vector(point[0],-point[1],0)
if not fcvec.equals(currentvec,lastvec):
if pole1.distanceToLine(lastvec,currentvec) < 10**(-1*Draft.precision()):
print "straight segment"
seg = Part.Line(lastvec,currentvec).toShape()
else:
print "quadratic bezier segment"
b = Part.BezierCurve()
b.setPoles([lastvec,pole1,currentvec])
seg = b.toShape()
print "connect ",lastvec,currentvec
lastvec = currentvec
lastpole = ('quadratic',pole1)
path.append(seg) path.append(seg)
point = [] point = []
@ -749,7 +820,7 @@ def decodeName(name):
try: try:
decodedName = (name.decode("latin1")) decodedName = (name.decode("latin1"))
except UnicodeDecodeError: except UnicodeDecodeError:
print "dxf: error: couldn't determine character encoding" print "svg: error: couldn't determine character encoding"
decodedName = name decodedName = name
return decodedName return decodedName