Revit 2023 - Analytical Model - Identify associated physical element

With the new Revit 2023 workflow regarding the analytical model (in which I have to draw the physical model, draw the analytical model, and then associate the corresponding elements) if the type of the analytical bar is changed (for example after a structural analysis was performed in Robot), it doesn´t update the physical model to which it is associated.
In order to make a Dynamo script to do so, I would like to get/identify (within Dynamo) the physical element to which each analytical element is associated --for example create a shared parameter for analytical elements “associated to” and use Dynamo to automatically fill it in with the physical element´s Revit ID of the physical element to which it is associated. However, I couldn´t find a Dynamo node that allows me to identify to which physical element the analytical element is associated. Is there a way to do so? Are there any suggestions either with Dynamo nodes or Revit API?

@LuSalemme ,

Are you looking for that ?

import clr
import sys
sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib')
import System
from System import Array
from System.Collections.Generic import *
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.DB.Structure import StructuralSettings as StruSet
from Autodesk.Revit.UI import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication 
app = uiapp.Application 
uidoc = uiapp.ActiveUIDocument
struSettings = StruSet.GetStructuralSettings(doc)
supports = struSettings.AnalyticalModelAutoCheckMemberSupports
consistency = struSettings.AnalyticalModelAutoCheckConsistency

def convert(x):
	vers = DocumentManager.Instance.CurrentDBDocument.Application.VersionNumber
	if int(vers) < 2022:UIunit = Document.GetUnits(doc).GetFormatOptions(UnitType.UT_Length).DisplayUnits
	else: UIunit = Document.GetUnits(doc).GetFormatOptions(SpecTypeId.Length).GetUnitTypeId()
	return UnitUtils.ConvertFromInternalUnits(x,UIunit)
		
#Tolerances
supportDist = convert(struSettings.AnalyticalModelSupportDistanceTolerance)
analyPhysiDist = convert(struSettings.AnalyticalModelDiscrepancyTolerance)
horzLink = convert(struSettings.AnalyticalModelHorizontalAutofixTolerance)
vertLink = convert(struSettings.AnalyticalModelVerticalAutofixTolerance)
AnaLink = convert(struSettings.AnalyticalLinkAutofixTolerance)
#Element checks
circularRefCheck = struSettings.AnalyticalModelCheckCircularReferences
#Physical/analytical model consistency checks
checkAdjust = struSettings.AnalyticalModelCheckAdjustment
checkSuppDist = struSettings.AnalyticalModelCheckSupportDistance
checkBeamSlabDist = struSettings.AnalyticalModelCheckBeamSlabDistance
checkInstability = struSettings.AnalyticalModelCheckInstability
checkDiscrepancy = struSettings.AnalyticalModelCheckDiscrepancy
checkVaildAssets = struSettings.CheckAnalyticalModelAsset



OUT = consistency, supportDist, analyPhysiDist, horzLink, vertLink, AnaLink, circularRefCheck, checkAdjust, checkSuppDist, checkBeamSlabDist, checkInstability, checkInstability, checkDiscrepancy, checkVaildAssets

i just was able to run the code in 2022…
grafik

@Draxl_Andreas thank you for your answer.
I have tried your suggestion and I don´t think this is what I was looking for. What I need is to idintify --either through Revit ID, mark, or any other parameter-- to which physical element an analytical element is associated to. For example, which is the beam an analytical bar is representing (it would be the one to which it is “associated”). This is to use specifically in Revit 2023, due to the new worflow for Revit Structures and analytcal models in this version.

While researching, after I started this post, I found (in the links copied below) that I should use the function GetAssociatedElementId from the Revit API. However, none of the examples were written in Python, so I am trying to learn/figure out how I should use it correctly within Dynamo, given I am quite new in working with Revit API.

If there are any suggestions regarding this, or any other method I should be using I would appreciated very much.
Thank you for your time,
Regards


Links mentioned above:

Revit 2023 Structural Analytical Model API - YouTube (min 26:20)

Options I found:
1) Revit 2023.1
Some of the tasks I wanted to perform were added to Revit´s new version: 2023.1. This update should be downloaded from Autodesk Desktop Application (after downloading and insatlling Revit 2023). New functions include:
–Creating automatically the physical model from the analytical model
–If the element has an association (physical to analytical, or analytical to physical) it can be updated according to changes in its associated element (e.g: changes in section, material, position, length, etc). Disclaimer: if position (geometry) is updated, the associated element relocates with exact coincidence to the moved object, it does not respect previuos relative position (“offset”).
–While modeling the structural analytical representation using the physical model as context, the physical and analytical elements are automatically associated. Also, each analytical element automatically inherit the associated parameters from the physical counterpart.
Explanations about any of these can be found in Autodesk Revit 2023 Help page (remember they will be available after updating to Revit 2023.1!!)

2) Dynamo package: Structural Design
The Structural Design Dynamo package by tomasz.fudala has great nodes related to these tasks. I personally was looking for the AnalyticalMember.GetAssociatedElement node, but I very much recommend checking all its possibilities.

3) Revit API
Use GetAssociatedElementId (or others such as HasAssociation) from Revit API. These are new for Revit 2023. More can be found in: Help (Autodesk Revit 2023 → Analyse the Design → The Structural Analytical Model → Upgrade the Analytical Model → The Contextual Analytical Model in Revit API)

1 Like