Revit API Tips: Dimension API の更新(Revit 2025~)

Revit プロジェクト環境における寸法要素の作成について、Revit 2025 では、Dimension クラスが改修され、Dimension クラスを基底クラスとして、各寸法オブジェクトの派生クラスが作成されました。

Screenshot of a computer software interface featuring architectural design tools and options.

Revit 2024 API までは、NewDimension()メソッドで長さ寸法を作成する方法が提供されてきました。

また、指定点高さ/指定点座標(SpotDimension)は、Document.NewSpotElevation()/NewSpotCoordinate()メソッド、角度寸法(AngularDimension)は、AngularDimension.Create()メソッドのように、それぞれ作成方法に統一感がない状態で公開されておりました。

A technical drawing featuring a curved path with various dimensions labeled, including an angle of 60 degrees, a length of 20 feet, a radius of 6 feet, and a total length of 19 feet 10 3/4 inches.

Dimension API が整理されたことで、寸法作成の実装がしやすくなりました。

新規クラス

Autodesk.Revit.DB.Element
Autodesk.Revit.DB.Dimension
Autodesk.Revit.DB.AngularDimension(角度寸法)
Autodesk.Revit.DB.LinearDimension(長さ寸法)
Autodesk.Revit.DB.RadialDimension(半径・直径寸法)
Autodesk.Revit.DB.SpotDimension(弧長寸法)

新規メソッド

•RadialDimension.Create(Document, View, Reference, XYZ origin, bool isDiameterDimension)
•ArcLengthDimension.Create(Document, View, Arc, Reference, Reference firstRef, Reference secondRef)
•LinearDimension.Create(Document, View, Line, IList<Reference>)

なお、これまでご利用いただいていた Document.NewDimension()メソッドは、Revit 2025, Revit 2026 でも引き続きご利用いただけます。
ただし、このメソッドで作成されるオブジェクトは LinearDimension クラスのインスタンスになります。

ぜひ新しいクラスとメソッドもお試しください。


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading