Showing temporary X and Y dimensions via script?

Hello,
you think it is attainable to get the display of the temporary dimensions following x and y via the api

For now, I manage to get them via a dialog box


python script:

import clr

clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager 
from RevitServices.Transactions import TransactionManager 

clr.AddReference("RevitAPI")
clr.AddReference("RevitAPIUI")

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

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication 
app = uiapp.Application 
uidoc = uiapp.ActiveUIDocument

snapTypes=Selection.ObjectSnapTypes.Intersections
if IN[0]:
    PA=uidoc.Selection.PickPoint(snapTypes,'Selection du Point A')
    PB=uidoc.Selection.PickPoint(snapTypes,'Selection du Point B')

PA_Dyn=PA.ToPoint()
PB_Dyn=PB.ToPoint()
deltaX=str(round(PB_Dyn.X-PA_Dyn.X,3))+' m'
deltaY=str(round(PB_Dyn.Y-PA_Dyn.Y,3))+' m'
Long=str(round(((PB_Dyn.X-PA_Dyn.X)**2+(PB_Dyn.Y-PA_Dyn.Y)**2)**0.5,3))+' m'
TaskDialog.Show('Delta X - Delta Y - Longueur',deltaX+ " - " + deltaY + "  - " + Long)
OUT = deltaX,deltaY,Long

cordially
christian.stan

1 Like

In what context? When do you want them showing and when do you not? Are you drawing the line with Dynamo or are you only selecting it to see the dimensions? Have you looked into what control you have natively in Revit?

I try to have the possibility of the function dimension of Revit
image

(to display X and Y temporarily),
only selecting it to see the dimensions
Via a script that I launch from the dynamo player.

By digging through revit documentation, I know that by pressing shift you can have only one of the X or Y dimensions depending on the angular position (automatic shimming on one to the other depending on the polar angle) of the line pointing.

I don’t know if I answered your questions correctly.

Cordially
christian.stan

Walk me through your intended process. How would you expect this to work out of the box? Remember that Dynamo can’t do anything that Revit doesn’t already allow. If Revit only shows one dimension you can’t make Dynamo show two. You could create dimensions and then remove them as a workaround. But that would have to be during a Dynamo transaction.

1 Like

I suspected a little that it smelled of fir, as I did not see anything about temporary dimension in the API, thank you for confirming me, I retain your point of view as a solution.
Cordially
christian.stan

You could possibly create a workaround, but it would strongly depend on your intended process.

1 Like

Might be something worth reviewing here: Revit API Temporary In-Canvas Graphics - YouTube

2 Likes

Thank you for the link Mr. Jacob, it’s quite a step to climb for the level that is mine now.

Cordially
christian.stan

1 Like

I teased the Autodesk.Revit.UI domain and a few of these classes a bit, in the script posted
about the process.

Cordially
christian.stan