Skip to main content

revit-element-and-parameter-access

Read and write Autodesk Revit elements and parameters with the Nice3point.Revit.Extensions fluent accessors. USE FOR: finding an Element by ElementId, finding a parameter by BuiltInParameter/ParameterTypeId/Guid/name, reading its typed value, setting it, and converting internal units. DO NOT USE FOR: querying the model for a set of elements (use revit-element-collector).

설치로 이동

소스 정보

저장소
Nice3point/revit-skills
최근 소스 활동
2026년 9월 6일 12:40
감지된 SKILL.md 언어
영어
스타
13
포크
3

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
revit-element-and-parameter-access
description
Read and write Autodesk Revit elements and parameters with the Nice3point.Revit.Extensions fluent accessors. USE FOR: finding an Element by ElementId, finding a parameter by BuiltInParameter/ParameterTypeId/Guid/name, reading its typed value, setting it, and converting internal units. DO NOT USE FOR: querying the model for a set of elements (use revit-element-collector).
license
MIT
# Revit Element and Parameter Access The `Nice3point.Revit.Extensions` accessors wrap the raw element and parameter API — `document.GetElement(id) as T`, raw different parameter getters, manual `StorageType` switching, and `UnitUtils` — into one fluent, nullable chain. `FindParameter` also falls back to the element type when the instance lacks the parameter. ## When to use - Finding an `Element` by `ElementId`. - Reading or writing a parameter value, or converting a stored length to display units. ## When not to use - Finding a set of elements from the model — use `revit-element-collector`. ## Workflow ### Step 1: Get a typed element from an id ```csharp var wall = wallId.ToElement<Wall>(document); ``` Returns null when the element is missing or not that type. ### Step 2: Find a parameter ```csharp var parameter = wall.FindParameter(BuiltInParameter.WALL_USER_HEIGHT_PARAM); ``` `FindParameter` accepts a `BuiltInParameter`, `ParameterTypeId`, `Guid`, or name, and returns the type's parameter when the instance has none. It returns null when the parameter is absent — null-check for optional parameters. ### Step 3: Read the typed value ```csharp double heightFeet = parameter.AsDouble(); // native api call bool isStructural = wall.FindParameter(BuiltInParameter.WALL_STRUCTURAL_SIGNIFICANT).AsBool(); Color color = door.FindParameter("Door color").AsColor(); Level level = wall.FindParameter(BuiltInParameter.WALL_BASE_CONSTRAINT).AsElement<Level>(); ``` ### Step 4: Convert internal units at the boundary Revit stores lengths in feet; convert when values leave or enter the model. ```csharp double heightMm = parameter.AsDouble().ToMillimeters(); ``` ### Step 5: Write inside a transaction ```csharp parameter.Set(3.0.FromMeters()); door.FindParameter("Door color").Set(new Color(66, 69, 96)); ``` Writes require an open transaction. ## Validation - [ ] `ElementId` is resolved with `ToElement<T>`, not `GetElement(id) as T`. - [ ] Parameters are found with `FindParameter`, and optional ones are null-checked. - [ ] Stored lengths are converted at the boundary with the unit conversion extensions. - [ ] Writes happen inside a transaction. ## Common Pitfalls | Pitfall | Correct approach | |-----------------------------------------------------------------|--------------------------------------------------------------| | `document.GetElement(id) as Wall` | `id.ToElement<Wall>(document)`. | | Choosing among `get_Parameter`/`LookupParameter`/`GetParameter` | `FindParameter(...)` handles instance and type. | | Using a raw feet value as millimeters | Convert with `.ToMillimeters()` / `.FromMeters()`. | | `ToElement`/`FindParameter` not found | The `Nice3point.Revit.Extensions` package is not referenced. |
GitHub에서 보기