Skip to content

Commit

Permalink
Arch: Adapted IFC importer for new IfcOpenShell6
Browse files Browse the repository at this point in the history
Squashed following commits:
* Arch: Adapted IFC importer for IfcOpenShell6
* Arch: further fixes for ifcopenshell6 compatibility
* Arch: IFC importer now converts to/from  meters for better compatibility with IfcOpenShell
* Arch: further fixes with ifcopenshell6
* Arch: precision adjustments in IFC exporter
* Arch: small fix in makeRoof
  • Loading branch information
yorikvanhavre committed Feb 13, 2015
1 parent 6202476 commit 40f0927
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 124 deletions.
9 changes: 5 additions & 4 deletions src/Mod/Arch/ArchComponent.py
Expand Up @@ -26,10 +26,10 @@
__url__ = "http://www.freecadweb.org"

# Possible roles for IFC objects
Roles = ['Undefined','Beam','Beam Standard Case','Chimney','Column','Column Standard Case','Covering','Curtain Wall',
'Door','Door Standard Case','Foundation','Furniture','Hydro Equipment','Electric Equipment',
'Member','Plate','Railing','Ramp','Ramp Flight','Rebar','Pile','Roof','Shading Device','Slab','Space'
'Stair','Stair Flight','Tendon','Wall','Wall Standard Case','Wall Layer','Window','Window Standard Case']
Roles = ['Undefined','Beam','Chimney','Column','Covering','Curtain Wall',
'Door','Foundation','Furniture','Hydro Equipment','Electric Equipment',
'Member','Plate','Railing','Ramp','Ramp Flight','Rebar','Pile','Roof','Shading Device','Slab','Space',
'Stair','Stair Flight','Tendon','Wall','Wall Layer','Window']

import FreeCAD,Draft
from FreeCAD import Vector
Expand Down Expand Up @@ -301,6 +301,7 @@ def __init__(self,obj):
self.Type = "Component"
self.Subvolume = None
self.MoveWithHost = False
obj.Role = Roles

def execute(self,obj):
return
Expand Down
78 changes: 39 additions & 39 deletions src/Mod/Arch/ArchRoof.py
Expand Up @@ -47,45 +47,45 @@ def makeRoof(baseobj=None,facenr=1, angles=[45.,], run = [], idrel = [0,],thickn
_ViewProviderRoof(obj.ViewObject)
if baseobj:
obj.Base = baseobj
if obj.Base.isDerivedFrom("Part::Feature"):
if (obj.Base.Shape.Faces and obj.Face):
w = obj.Base.Shape.Faces[obj.Face-1].Wires[0]
elif obj.Base.Shape.Wires:
w = obj.Base.Shape.Wires[0]
if w:
if w.isClosed():
edges = DraftGeomUtils.sortEdges(w.Edges)
l = len(edges)

la = len(angles)
alist = angles
for i in range(l-la):
alist.append(angles[0])
obj.Angles=alist

lr = len(run)
rlist = run
for i in range(l-lr):
rlist.append(w.Edges[i].Length/2.)
obj.Runs = rlist

lidrel = len(idrel)
rellist = idrel
for i in range(l-lidrel):
rellist.append(0)
obj.IdRel = rellist

lthick = len(thickness)
tlist = thickness
for i in range(l-lthick):
tlist.append(thickness[0])
obj.Thickness = tlist

lover = len(overhang)
olist = overhang
for i in range(l-lover):
olist.append(overhang[0])
obj.Overhang = olist
if obj.Base.isDerivedFrom("Part::Feature"):
if (obj.Base.Shape.Faces and obj.Face):
w = obj.Base.Shape.Faces[obj.Face-1].Wires[0]
elif obj.Base.Shape.Wires:
w = obj.Base.Shape.Wires[0]
if w:
if w.isClosed():
edges = DraftGeomUtils.sortEdges(w.Edges)
l = len(edges)
la = len(angles)
alist = angles
for i in range(l-la):
alist.append(angles[0])
obj.Angles=alist
lr = len(run)
rlist = run
for i in range(l-lr):
rlist.append(w.Edges[i].Length/2.)
obj.Runs = rlist
lidrel = len(idrel)
rellist = idrel
for i in range(l-lidrel):
rellist.append(0)
obj.IdRel = rellist
lthick = len(thickness)
tlist = thickness
for i in range(l-lthick):
tlist.append(thickness[0])
obj.Thickness = tlist
lover = len(overhang)
olist = overhang
for i in range(l-lover):
olist.append(overhang[0])
obj.Overhang = olist
obj.Face = facenr
return obj

Expand Down
2 changes: 2 additions & 0 deletions src/Mod/Arch/ArchSpace.py
Expand Up @@ -214,6 +214,8 @@ def getShape(self,obj):
def getArea(self,obj):
"returns the horizontal area at the center of the space"
import Part,DraftGeomUtils
if not hasattr(obj.Shape,"CenterOfMass"):
return 0
try:
pl = Part.makePlane(1,1)
pl.translate(obj.Shape.CenterOfMass)
Expand Down
36 changes: 0 additions & 36 deletions src/Mod/Arch/Resources/ui/archprefs-import.ui
Expand Up @@ -116,42 +116,6 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="toolTip">
<string>A scaling factor to apply to imported IFC objects</string>
</property>
<property name="text">
<string>Scaling factor</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefDoubleSpinBox" name="gui::prefdoublespinbox">
<property name="toolTip">
<string>IFC files are typically written in millimeters. If you are working in a different unit, this allow you to scale all your units to be expressed in millimeters.</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="maximum">
<double>99999.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
<cstring>IfcScalingFactor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
Expand Down

0 comments on commit 40f0927

Please sign in to comment.