How to know where is the Origin Point of a Title Block and where is its geometry located from that point

Hello,

Very simple question, but I do not know how to visualise in Dynamo. How to know where is the Origin Point of a Title Block and where is its geometry located from that point?

I do not know how far are the contour lines of the title block from that origin, as I cannot set up the origin in the title block family I belive.

Easiest way: Open the family and draw a line with a start point where you want the origin to be. Copy that line, and then in dynamo select the copy and move it by the inverse vector created by the start point of the line.

how do I get in Dynamo the lines of a title block placed on a sheet?

Simple non-program way is to make an X in AutoCAD at 0,0,0 and import that into your titleblock family origin-to-origin. X will mark 0,0. If I recall correctly, a lot of the Revit templates have the lower left off the 0,0 by some 256th of an inch. No idea why or if that is just ahold over from days gone by.
image

1 Like

but in python…

#! python3
import clr
import sys
from enum import Enum
import math
import traceback

import System
from System import Array
from System.Collections.Generic import *
clr.AddReference("RevitAPI")
clr.AddReference("RevitAPIUI")

import Autodesk 
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *

doc = __revit__.ActiveUIDocument.Document
uidoc = __revit__.ActiveUIDocument
uiapp = __revit__
app = uiapp.Application

fmanager = FamilyManager

myDocs = uiapp.Application.Documents

selection = uidoc.Selection.GetElementIds()

doctype = doc.IsFamilyDocument

def getCurrentView(myDoc):
    activeView = myDoc.ActiveView
    return activeView

def getViewScale(myView):
    return float(myView.Scale)

def drawCircle(myScale, mydoc, myview):
    try:
        myXYZ = XYZ(0.0,0.0,0.0)
        myX = XYZ(1.0, 0.0, 0.0)
        myY = XYZ(0.0, 1.0, 0.0)
        myZ = XYZ(0.0, 0.0, 1.0)
        myFrame = Frame(myXYZ, myX, myY, myZ)
        myPlane = Plane.Create(myFrame)
        arcradius = myScale/12.0
        startAngle = 0.0;#The unit is radian
        endAngle = 2 * math.pi #this arc will be a circle
        myArc = Arc.Create(myXYZ, arcradius, startAngle, endAngle, myX, myY)
        t = Transaction(doc, "Model Line")
        t.Start()
        if not doctype:
            mySketchPlane = SketchPlane.Create(doc, myPlane)
            myDetailCurve = mydoc.Create.NewDetailCurve(myview, myArc)
        else:
            myDetailCurve = mydoc.FamilyCreate.NewDetailCurve(myview, myArc)
        myparam = myDetailCurve.get_Parameter(BuiltInParameter.ARC_CURVE_CNTR_MRK_VISIBLE)
        myparam.Set(1)
        myStyles = myDetailCurve.GetLineStyleIds()
        for ls in myStyles:
            e = doc.GetElement(ls)
            if e.Name == "Red":
                myNewStyle = e
        if not doctype:
            myDetailCurve.LineStyle =myNewStyle
        t.Commit()
    except:
        t.RollBack()
        traceback.print_exc()
        pass
    return myArc

def activePlane(myView):
    pass
currView = getCurrentView(doc)
myScale = getViewScale(currView)
myCircle = drawCircle(myScale, doc, currView)

1 Like

What have you tried?

I’d start with Select model element, select a title block instance, and then uses Element.Geometry. If that fails, post it and we can discuss from there.

thanks, I do not want to create annotative elements in sheets, but would like to know where is the origin point of the sheet and where is a point of the title block to know where to place views over the title block placed on a sheet, so I need to specify coordinates that make no sense if not knowing this

not the easy way but what I was asking I resolved myself:

import clr
# Import RevitAPI Classes
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitNodes')
import Revit
# Import DocumentManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
clr.ImportExtensions(Revit.GeometryConversion)

if isinstance(IN[0], list) : sheets = UnwrapElement(IN[0])
else : sheets = [UnwrapElement(IN[0])]

titleBlock=[]
for sheet in sheets:
	doc=sheet.Document
	title=FilteredElementCollector(doc,sheet.Id).OfCategory(BuiltInCategory.OST_TitleBlocks).ToElements()
	titleBlock.extend(title)

annotations=UnwrapElement(titleBlock)
if not hasattr(annotations, '__iter__'):
    annotations = [annotations]

BBox = []

for anno in annotations:
    viewId = anno.OwnerViewId
    view = doc.GetElement(viewId)
    BBox.append(anno.BoundingBox[view].ToProtoType())

#if isinstance(titleBlock, list): OUT = BBox
#else: OUT = BBox[0]

OUT = [XYZ(bbox.MinPoint.X,bbox.MinPoint.Y,bbox.MinPoint.Z) for bbox in BBox]

or this:

import clr
# Import RevitAPI Classes
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitNodes')
import Revit
# Import DocumentManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
clr.ImportExtensions(Revit.GeometryConversion)

sheets = UnwrapElement(IN[0]) if not isinstance(IN[0], list) else [UnwrapElement(e) for e in IN[0]]
OUT = [XYZ(bbox.MinPoint.X,bbox.MinPoint.Y,bbox.MinPoint.Z) for sheet in sheets for title in FilteredElementCollector(sheet.Document, sheet.Id).OfCategory(BuiltInCategory.OST_TitleBlocks).ToElements() for anno in [UnwrapElement(title)] if hasattr(anno, 'OwnerViewId') for bbox in [anno.BoundingBox[doc.GetElement(anno.OwnerViewId)].ToProtoType()]]
1 Like