
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Let's say I create a ViewPlan with a CropBox specified by the return value of a function "bounds(elements)".
t = Transaction(doc, "Create plan view."); t.Start() view = ViewPlan.Create(doc, template.Id, level.Id) view.CropBoxActive = True view.CropBox = bounds(elements) t.Commit()
This works well -- I get back a ViewPlan perfectly fitted around the elements I'm interested in.
Now let's say I want to change the aspect ratio of the ViewPlan after the initial commit (say, doubling the height of the CropBox). I can write a function "resize(current_cropbox, ratio)" that takes an existing ViewPlan's CropBox and desired aspect ratio and calculates a new CropBox meeting my aspect criteria. I then start a Transaction to update the CropBox:
t = Transaction(doc, "Attempt view resize"); t.Start() view.CropBox = resize(view.CropBox, 2.0) t.Commit()
This doesn't do anything. After the Commit(), the CropBox values remain unchanged, despite the fact that aspect() is calculating a new BoundingBoxXYZ object.
Why does this happen? Is it possible to modify a View's CropBox after creation?
I see this has been asked before:
http://forums.autodesk.com/t5/revit-api/update-view-cropbox-extents/m-p/2442052/highlight/true#M1182
...but I haven't found a clear conclusion to the problem. Any pointers are appreciated.
Thanks in advance!
NB. Tested on Revit 2014 using IronPython.
Solved! Go to Solution.