Skip to content

Commit 653d236

Browse files
authored
Update roomSvgExporter.py
fix floor/ceiling problem with negative numbers introduce comments to allow easy change to svg from areas
1 parent b0a0246 commit 653d236

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

revitAPI/roomSvgExporter.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
__author__ = 'Adam Bear - adam@ukbear.com'
88
__twitter__ = '@adambear82'
99
__github__ = '@adambear82'
10-
__version__ = '1.0.0'
10+
__version__ = '1.0.1'
1111

1212
'''
1313
for large projects with lots of room data it is useful to analyse in
@@ -46,6 +46,9 @@
4646
FilterDoubleRule, FilterNumericGreater, LogicalAndFilter, \
4747
ModelPathUtils, ParameterValueProvider, SpatialElement, \
4848
SpatialElementBoundaryOptions, SpatialElementBoundaryLocation
49+
# to create svg of areas instead of rooms import the room filter
50+
# so that rooms can be filtered instead of areas
51+
from Autodesk.Revit.DB.Architecture import RoomFilter
4952

5053
# add reference for RevitServices (RevitServices)
5154
clr.AddReference('RevitServices')
@@ -195,6 +198,8 @@ def ListChopUnevenly(chopList, chopLengths) :
195198

196199
# alias areaFilter, for areas (not rooms) we will want to exclude
197200
areaFilter = AreaFilter()
201+
# change to room filter if you want svg of areas not rooms
202+
#areaFilter = RoomFilter()
198203
# collect elements to be excluded
199204
areaExcludes = fec(doc).WherePasses(areaFilter).ToElements()
200205
# convert to a list if not allready so
@@ -422,20 +427,23 @@ def ListChopUnevenly(chopList, chopLengths) :
422427

423428
# min x value from nested sublist extracted using consecutive min()
424429
xmin = min(min(x))
425-
# min x value rounded up for use in svg tag
426-
xminc = math.ceil(xmin)
430+
# min x value rounded up/down for +/-ve numbers for use in svg tag
431+
if xmin < 0 : xminc = math.floor(xmin)
432+
else : xminc = math.ceil(xmin)
427433
# max x value from nested sublist extracted using consecutive max()
428434
xmax = max(max(x))
429435
# width of svg viewbox rounded up from, max - min
430-
width = math.ceil(xmax - xmin)
436+
width = math.ceil(xmax - xminc)
431437
# min y value from nested sublist extracted using consecutive min()
432438
ymin = min(min(y))
433-
# min y value rounded up for use in svg tag
434-
yminc = math.ceil(ymin)
439+
# min y value rounded up/down for +/-ve numbers for use in svg tag
440+
if ymin < 0 : yminc = math.floor(ymin)
441+
else : yminc = math.ceil(ymin)
442+
#yminc = math.ceil(ymin)
435443
# max y value from nested sublist extracted using consecutive max()
436444
ymax = max(max(y))
437445
# height of svg viewbox rounded up from, max - min
438-
height = math.ceil(ymax - ymin)
446+
height = math.ceil(ymax - yminc)
439447
# create a list of values
440448
svg = svgStart, xminc, yminc, width, height, svgTransform, svgScale, \
441449
svgEnd

0 commit comments

Comments
 (0)