Resize Elevation Crop Region
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
Apologies if the format of the post is not up to standards or if the topic has already been addressed somewhere.
I did do a lot of searches both here and on The Building Coder pages and couldn't find a solution or an explanation.
I am not really sure how to ask this but here it goes:
I want to be able to resize the elevation crop region based on locations of grids and levels on the view.
I seem to make the south/north elevations (elev-A) work pretty well, but I am not able to make the east elevation (elev-B) work.
elev-A
elev-B
For elev-B, I end up with a 1' long crop region. The top and bottom are correct but the left and right extents are not.
This is the python code I am using on the elev-A which is working perfectly:
-----------------------------------------------------------------------------------------
aview = doc.ActiveView
#find visible grids on current view
gridsonview = []
for g in grids:
if g.CanBeVisibleInView(aview):
gridsonview.append(g)
cborg = aview.CropBox.Transform.Origin
if aview.ViewDirection.Y == -1:
#find grid x coordinates
gridmins = [gm.GetCurvesInView(DB.DatumExtentType.Model, aview)[0] \
.GetEndPoint(0).X for gm in gridsonview]
gridsbymmin = dict(zip(gridmins, gridsonview))
#grids on view ordered by coordinates
sorted = [gridsbymmin[vminvalue] for vminvalue in sorted(gridmins)]
tz = Transaction(doc, "South facing view crop box")
tz.Start()
aview.CropBoxActive = False
#left grid X
lgx = sorted[0].GetCurvesInView(DB.DatumExtentType.Model, aview)[0] \
.GetEndPoint(0)
#right grid X
rgx = sorted[-1].GetCurvesInView(DB.DatumExtentType.Model, aview)[0] \
.GetEndPoint(0)
#grid top Z
tgy = sorted[0].GetCurvesInView(DB.DatumExtentType.Model, aview)[0] \
.GetEndPoint(1)
#grid bottom Z
bgy = sorted[0].GetCurvesInView(DB.DatumExtentType.Model, aview)[0] \
.GetEndPoint(0)
min = XYZ(lgx.X - cborg.X - offset, bgy.Z - cborg.Z - 1, 0)
max = XYZ(rgx.X - cborg.X + offset, tgy.Z - cborg.Z + 1 + (bubblesize * aview.Scale), 0)
nsb = BoundingBoxXYZ()
nsb.Min = min
nsb.Max = max
aview.CropBox = nsb
aview.CropBoxVisible = True
aview.CropBoxActive = True
tz.Commit()-----------------------------------------------------------------------------------------
With this logic.. what should the nsb BoundingBox coordinates be for elev-B so that I get the correct crop region?
Thank you in advance!