geometry.region — Resolve one region of a loaded geometry asset by ID, name, or tag.
region = geometry.region(asset, selector) finds exactly one region of a geometry.Asset and returns it as an immutable geometry.Region bound to that asset's identity and revision.
Syntax
region = geometry.region(asset, selector)Inputs
asset- Type
Any- Required
- Yes
- Default
- —
- Description
- geometry.Asset returned by geometry.load.
selector- Type
StringScalar- Required
- Yes
- Default
- —
- Description
- Exact region ID, name, or tag; optionally prefixed with id:, region:, name:, or tag:.
Returns
region- Type
Any- Description
- Immutable geometry.Region bound to the asset's identity and revision.
Errors
RunMat:geometry:region:InvalidRegion- When
- The selector is empty, uses an unsupported prefix, matches no region, or matches more than one region.
- Message
geometry.region: invalid region selection
RunMat:geometry:region:InvalidInput- When
- The call does not pass exactly a geometry.Asset and a scalar text selector.
- Message
geometry.region: invalid input
Behavior
Matching is exact and case-sensitive. If selector equals a region ID it selects that region, even when the ID itself contains a colon. Otherwise a prefix restricts the field that is matched: id: or region: match the region ID, name: the imported name, and tag: the imported tag. Without a prefix the selector may match any of the three. Exactly one region must match; any other prefix, an empty selector or value, no match, or several matches is an error, and an ambiguous match suggests an id: selector.
The result has the properties geometry_id, geometry_revision (a uint32), region_id, and name, plus tag when the imported region has one. It is an immutable value; it records which asset revision it came from so that model constructors can check it against the model's geometry.
Region IDs come from the importer. Exact CAD imports (STEP, IGES, BREP) publish one region per face, with IDs such as face_000001, names such as Face 1, and the tag occt_face. Mesh formats such as STL publish a single region_default region named Default Region with the tag mesh_default. Use geometry.listRegions or asset.regions to see what a file contains before choosing selectors.
The call works on an asset that is already loaded. It is pure: it reads no files and does not suspend.
Use in a study
Regions are how a script-built model names where materials, constraints, and loads apply. Pass a face region to a boundary constructor such as fea.StructuralConstraint.fixed("support", geometry.region(part, "face_000001")), or a solid region to fea.PropertyRegionTarget.solid for a fea.materialAssignment, then assemble them with fea.model on the same asset.
Prefer id: selectors in scripts that must stay stable: names and tags come from the CAD author and need not be unique.
Errors
RunMat:geometry:region:InvalidRegion reports an empty selector or value, an unsupported prefix, a selector that matches no region, or one that matches several regions; the message names the selector and the match count.
RunMat:geometry:region:InvalidInput reports a call that does not pass exactly a geometry.Asset and a scalar text selector.
Examples
Select the default region of an STL by ID and by tag
part = geometry.load('part.stl');
body = geometry.region(part, 'region_default');
same = geometry.region(part, 'tag:mesh_default');
body.nameSelect a face of an exact CAD solid for a support
part = geometry.load('box.brep', 'Units', 'm');
supportFace = geometry.region(part, 'face_000001');
sameFace = geometry.region(part, 'name:Face 1');
supportFace.tagA selector that matches nothing is an error
part = geometry.load('part.stl');
region = geometry.region(part, 'name:Top');Using geometry.region with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how geometry.region changes the result.
Run a small geometry.region example, explain the result, then change one input and compare the output.
FAQ
Two faces share a name. How do I pick one?⌄
Use its region ID, for example geometry.region(part, 'id:face_000004'). A name or tag that matches several regions is rejected rather than resolved arbitrarily.
Does a region stay valid if I reload the file?⌄
The region records the asset's geometry_id and geometry_revision. Resolve regions from the asset you pass to the model so the two always agree.
Related Geometry functions
Triangulation
DelaunayTri · DelaunayTri.freeBoundary · DelaunayTri.nearestNeighbor · DelaunayTri.pointLocation · freeBoundary · nearestNeighbor · pointLocation
Construction
geometry.box · geometry.chamfer · geometry.cylinder · geometry.edges · geometry.edgesIntroducedBy · geometry.extrude · geometry.faces · geometry.facesIntroducedBy · geometry.fillet · geometry.finish · geometry.hole · geometry.instance · geometry.intersect · geometry.pocket · geometry.revolve · geometry.solid · geometry.sphere · geometry.subtract · geometry.transform · geometry.union · geometry.withRegion
Related guides
Source you can read
Every RunMat function's source is public. Read exactly how geometry.region is executed, line by line, in Rust.
- View the source for geometry.region in Rust on GitHub
- Learn how the RunMat runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.