I am working on a script that renames the Viewport Detail Number based on the viewport location on the sheet by the cell it is in. I have looked at previous posts on this workflow and have used Nate holland’s Autodesk University 2015 presentation as basis of my diagram. I’m working in Revit 2023. Previous post on this topic with link to Nate holland’s presentation Previous post on Detail Numbers by Location, with shared graph
My problem is that when I get the titleblock location, through the FamilyInstance.Location node it is at (0,0,0) but when I get the ViewportBox.Outline and BoundingBox.MinPoint of the viewport, the zero-point locations don’t match between the titleblock and viewport. Below is a picture labeled with where the viewport and title block are.
Here is my graph working as intended for now, but I had to manually measure the difference in the viewport and titleblock zero points on the sheet space and include that in the graph.
I want to know why the zero points are different, so that the graph can work across multiple titleblock sizes and to avoid errors. Or maybe there is a way to get the difference between the zero points somehow and use that instead of manually measuring.
Make sure you take screenshots with node preview bubbles pinned so we can see your data. It’s also nice to include a short description of any python nodes so we have an idea of what they’re supposed to do.
Keep in mind, the BoxOutline is the thicker box that shows up when you hover over the viewport, not the visible crop region. When you hover over those viewports does the BoxOutline look like you’d expect?
Is there a reason you want to use the minimum point of the outline rather than something like the view center point? I think most people tend to go off the center point as it’s a better representation of where the view lies on the sheet.
Good point, the distinction between those two is confusing. I would have though crop region and annotation region set the BoxOutline. But after reviewing my viewport and ensuring the Outline matches the crop region I am still getting the minimum point of the viewports to be off the sheet when I have them moved to (0,0)
Another good point, I might change the graph to do that in the future. I was also thinking about getting the label offset so that I can get the location of the viewport title as what determines the Detail Number. But still not sure why the zero points aren’t matching.
OK I think I figured out the problem, my title block family must have something wrong with it. Tested my script on an OOTB template and the viewport min points are aligning with the Titleblock bottom corner which is correctly at (0,0). I should have thought to try that first haha.
I went back and looked at my final script not the one I shared in the link in the OP. My final one does what you are trying to do. I created it so long ago that I cannot remember why but I used Python to the the titleblocks location. I do remember there being a problem but that is all. You can try the code below and see if that helps at all.
import clr
import math
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
titleBlock = UnwrapElement(IN[0])
view = UnwrapElement(IN[1])
list = []
for i in titleBlock:
bbox = (i.BoundingBox[view])
pt = (bbox.Min.ToPoint(),bbox.Max.ToPoint())
list.append(pt)
TransactionManager.Instance.TransactionTaskDone()
OUT = list
@Nick_Boyts as far as using the lower left corner that is per the National Cadd Standards. Personally, I would like to use the top right but I am just one man.
If I remember correctly does FamilyInstance.Location gives the location of 0,0 within the family rather than the project? That could be why I used the Python code.
@Steven I think the Viewport.BoxOutline node wasn’t available at the time of your referenced post. I believe the FamilyInstance.Location node returns the location of the family within the project, at least from how I read the node description. Looking at my titleblock family I can’t figure out why it’s off though.