Parts — g.parts¶
A Part owns an isolated Gmsh session and exports a shape to STEP.
g.parts is the assembly-side registry that imports those STEPs back
in and tracks which tags belong to which label.
Part¶
apeGmsh.core.Part.Part ¶
Bases: _SessionBase
An isolated geometry unit — no meshing, no physical groups.
Parameters¶
name : str
Descriptive name (also used as the Gmsh model name).
auto_persist : bool, default True
When True, the Part writes its geometry to an OS tempfile
on end() if save() was not called explicitly. The
tempfile is reclaimed via weakref.finalize when the
Part is garbage-collected, or eagerly via cleanup().
Set to False to opt out — in that case parts.add(part)
will raise FileNotFoundError unless you called save()
by hand.
Source code in src/apeGmsh/core/Part.py
begin ¶
Open the Part's Gmsh session.
If the Part is being reused — a previous with part: block
auto-persisted a tempfile and this call re-enters — the stale
tempfile is cleaned up before the new session starts so the
next end() can auto-persist fresh geometry.
Source code in src/apeGmsh/core/Part.py
end ¶
Close the Part's Gmsh session.
When auto_persist=True and the user did not call
save() inside the session, the geometry is written to
an OS tempfile before Gmsh is finalised so the Part can
flow straight into assembly.parts.add(part).
Exceptions raised by auto-persist itself are caught and emitted as a warning rather than masking any exception the user's build code may have raised. Gmsh finalisation always runs.
Source code in src/apeGmsh/core/Part.py
cleanup ¶
Delete any auto-persisted tempfile now, without waiting for garbage collection.
Safe to call multiple times. Safe to call on a Part whose
file_path was set by explicit save() — the
_owns_file guard means the user's file is never
touched. After cleanup(), has_file returns False
and the Part can be re-built via a new with block.
Source code in src/apeGmsh/core/Part.py
save ¶
save(file_path: str | Path | None = None, *, fmt: str | None = None, write_anchors: bool = True, _internal_autopersist: bool = False) -> Path
Export the Part geometry to a CAD file.
Calling save() with a user-supplied path transfers
ownership of the output file to the caller — any
tempfile previously created by auto-persist is cleaned up
immediately, and the library will never delete the new
output.
Parameters¶
file_path : str, Path, or None
Destination path. If None, defaults to
"{name}.step". The extension determines the format
unless fmt overrides it.
fmt : str, optional
Force format: "step" or "iges".
write_anchors : bool, default True
Write a JSON sidecar ({file_path}.apegmsh.json)
carrying the label -> center-of-mass map for every
user-named entity in the Part. This is what lets
assembly.parts.add(part) expose the instance's
labels via inst.by_label('name'). The sidecar is
silently omitted when the Part has no user-named
entities, so there is no cost for small throwaway
Parts. Pass write_anchors=False to suppress
unconditionally — useful when publishing a CAD file
to third-party tools that shouldn't see apeGmsh
metadata.
Returns¶
Path Resolved path of the written file.
Source code in src/apeGmsh/core/Part.py
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | |
g.parts — registry¶
apeGmsh.core._parts_registry.PartsRegistry ¶
Bases: _PartsFragmentationMixin
Instance management composite — registered as g.parts.
Source code in src/apeGmsh/core/_parts_registry.py
part ¶
Track entities created inside the block as a named part.
Yields the label string. After the block, any entities that exist now but didn't before are stored as an Instance.
Example::
with g.parts.part("beam"):
g.model.geometry.add_box(0, 0, 0, 1, 0.5, 10)
Source code in src/apeGmsh/core/_parts_registry.py
register ¶
register(name: str, dimtags: list[DimTag] | None = None, *, label: str | None = None, pg: str | None = None, dim: int | None = None) -> Instance
Tag existing entities under a part name.
Exactly one of dimtags, label, or pg must be given.
Parameters¶
name : str
Unique part name.
dimtags : list of (dim, tag), optional
Entities to assign directly. Also accepted positionally
as the second argument.
label : str, optional
Name of an apeGmsh label (g.labels) whose entities
should be adopted.
pg : str, optional
Name of a physical group (g.physical) whose entities
should be adopted.
dim : int, optional
Forwarded to g.labels.entities(label, dim=dim) when
using label= and the label spans multiple dimensions.
Returns¶
Instance
Source code in src/apeGmsh/core/_parts_registry.py
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | |
from_model ¶
Adopt entities already in the Gmsh session as a named part.
Useful after g.model.io.load_step() or g.model.io.load_iges()
when you want the imported geometry tracked for constraints
and fragmentation.
Parameters¶
label : str Part name. dim : int, optional Dimension to adopt. If None, adopts all dimensions. tags : list[int], optional Specific entity tags to adopt. If None, adopts all untracked entities (not already assigned to a part).
Returns¶
Instance
Examples¶
::
# Load geometry, then adopt it
g.model.io.load_step("bracket.step")
g.parts.from_model("bracket")
# Adopt only specific volumes
g.parts.from_model("slab", dim=3, tags=[1, 2])
Source code in src/apeGmsh/core/_parts_registry.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | |
add ¶
add(part: 'Part', *, label: str | None = None, translate: tuple[float, float, float] = (0.0, 0.0, 0.0), rotate: tuple[float, ...] | None = None, highest_dim_only: bool = True) -> Instance
Import a saved Part into the session.
Parameters¶
part : Part
Must have been save()-d to disk.
label : str, optional
Auto-generated as "{part.name}_1" if omitted.
translate, rotate : placement transforms.
highest_dim_only : keep only highest-dim entities from the CAD.
Source code in src/apeGmsh/core/_parts_registry.py
import_step ¶
import_step(file_path: str | Path, *, label: str | None = None, translate: tuple[float, float, float] = (0.0, 0.0, 0.0), rotate: tuple[float, ...] | None = None, highest_dim_only: bool = True, properties: dict[str, Any] | None = None) -> Instance
Import a STEP or IGES file as a named instance.
Parameters¶
file_path : path STEP (.step, .stp) or IGES (.iges, .igs) file. label : str, optional Auto-generated from file stem if omitted. translate, rotate : placement transforms. properties : arbitrary metadata.
Source code in src/apeGmsh/core/_parts_registry.py
build_node_map ¶
Partition mesh nodes by instance bounding box.
Returns {label: {node_tag, ...}}.
Source code in src/apeGmsh/core/_parts_registry.py
build_face_map ¶
Partition surface elements by instance node ownership.
Returns {label: face_connectivity_array}.
Source code in src/apeGmsh/core/_parts_registry.py
get ¶
Return the Instance registered under label.
Useful when you didn't store the return value of
:meth:add / :meth:import_step and want to access an
Instance later — e.g. to apply inst.edit.* transforms::
g.parts.add(beam, label="b1")
g.parts.get("b1").edit.translate(0, 0, 50)
Raises¶
KeyError
If no instance is registered under label. The error
message lists the available labels so you can spot a typo.
Source code in src/apeGmsh/core/_parts_registry.py
labels ¶
rename ¶
Rename an instance.
Raises¶
KeyError if old_label does not exist. ValueError if new_label already exists.
Source code in src/apeGmsh/core/_parts_registry.py
delete ¶
Remove an instance from the registry.
The entities remain in the Gmsh session — they become "untracked" and will appear under the Untracked group in the viewer's Parts tab.
Raises¶
KeyError if label does not exist.
Source code in src/apeGmsh/core/_parts_registry.py
Instance¶
apeGmsh.core._parts_registry.Instance
dataclass
¶
Instance(label: str, part_name: str, file_path: Path | None = None, entities: dict[int, list[int]] = dict(), translate: tuple[float, float, float] = (0.0, 0.0, 0.0), rotate: tuple[float, ...] | None = None, properties: dict[str, Any] = dict(), bbox: tuple[float, float, float, float, float, float] | None = None, label_names: list[str] = list())
Bookkeeping record for one part placement.
Attributes¶
label : unique name inside the session
part_name : name of the source Part or file stem
file_path : CAD file that was imported (None for inline parts)
entities : {dim: [tag, ...]} — updated in-place by fragment
translate : applied translation (dx, dy, dz)
rotate : applied rotation (angle_rad, ax, ay, az[, cx, cy, cz])
properties : arbitrary user metadata
bbox : axis-aligned bounding box (xmin, ymin, zmin, xmax, ymax, zmax)
label_names : label names created for this instance (Tier 1
naming, e.g. ["col_A.shaft", "col_A.top"]).
Populated by _import_cad when the Part's CAD
file has a .apegmsh.json sidecar carrying
label definitions. These are NOT solver-facing
physical groups — use g.labels.entities(name)
to resolve entity tags, and
g.labels.promote_to_physical(name) to create
a solver PG when ready.
Part edit composite — part.edit¶
apeGmsh.core._part_edit.PartEdit ¶
Whole-Part operations composite. Registered as part.edit.
Source code in src/apeGmsh/core/_part_edit.py
translate ¶
Translate every entity in the Part by (dx, dy, dz).
Parameters¶
dx, dy, dz : float Translation components in model units.
Returns¶
PartEdit
self for chaining.
Raises¶
RuntimeError If the Part's session is not active.
Source code in src/apeGmsh/core/_part_edit.py
rotate ¶
rotate(angle: float, ax: float, ay: float, az: float, *, center: tuple[float, float, float] = (0.0, 0.0, 0.0)) -> 'PartEdit'
Rotate every entity by angle (radians) about an axis.
Parameters¶
angle : float
Rotation angle in radians. Right-hand rule: thumb
along (ax, ay, az), fingers curl positive.
ax, ay, az : float
Axis direction. Auto-normalized by gmsh.
center : (cx, cy, cz), default (0, 0, 0)
Point that the axis passes through.
Returns¶
PartEdit
self for chaining.
Source code in src/apeGmsh/core/_part_edit.py
mirror ¶
mirror(*, plane: str | None = None, normal: tuple[float, float, float] | None = None, point: tuple[float, float, float] = (0.0, 0.0, 0.0)) -> 'PartEdit'
Reflect every entity across a plane.
Specify the plane in one of two equivalent ways:
plane="xy"/"xz"/"yz"— coordinate plane throughpoint(default origin).normal=(nx, ny, nz)— explicit plane normal; the plane passes throughpointperpendicular to this vector.
Pass exactly one of plane or normal.
Returns¶
PartEdit
self for chaining.
Raises¶
ValueError
If neither or both of plane / normal are given,
or plane is not one of the recognized names.
Source code in src/apeGmsh/core/_part_edit.py
scale ¶
Uniform scale every entity by factor about center.
factor=2.0 doubles size, factor=0.001 is mm→m.
Source code in src/apeGmsh/core/_part_edit.py
dilate ¶
dilate(sx: float, sy: float, sz: float, *, center: tuple[float, float, float] = (0.0, 0.0, 0.0)) -> 'PartEdit'
Non-uniform scale by (sx, sy, sz) about center.
Source code in src/apeGmsh/core/_part_edit.py
affine ¶
Apply a general 4×4 affine transform.
Parameters¶
matrix4x4 : 16-element sequence, 4×4 nested list, or ndarray
Row-major. Last row typically [0, 0, 0, 1] (gmsh
ignores it but it must be present).
Source code in src/apeGmsh/core/_part_edit.py
delete ¶
Remove every entity from the Part's Gmsh session.
Useful when scrapping and rebuilding within the same with
block. Labels that pointed at the deleted entities are now
stale.
Returns¶
None
Source code in src/apeGmsh/core/_part_edit.py
copy ¶
Create a duplicate Part with a new label.
The duplicate is a brand-new :class:Part with its own
STEP file (and sidecar copy if present), _owns_file=True
so its tempfile is reclaimed when it's garbage-collected.
The duplicate is not entered as an active session — it
sits on disk ready to be consumed by g.parts.add() or
re-entered with with new_part: if you need to edit it
further.
Works whether the source Part is currently active or not:
- Active source — current geometry is dumped to a fresh
tempfile via
gmsh.write(does not disturb the source'sfile_path). - Inactive source — the existing STEP and sidecar are
file-copied via
shutil.
Parameters¶
label : str, required New Part name. If the name is already in use by another live Part in this process, a 4-char random suffix is appended and a warning is emitted.
Returns¶
Part
New Part with has_file=True, not yet active.
Raises¶
ValueError
If label is empty.
RuntimeError
If the source has no current geometry to copy.
Source code in src/apeGmsh/core/_part_edit.py
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | |
pattern_linear ¶
Create n translated copies along a line.
Each copy i (1..n) is shifted by (i*dx, i*dy, i*dz)
from the source. The source itself is not modified and
is not included in the returned list.
Source Part must be non-active (outside its with block).
Parameters¶
label : str
Base name. Generated names are {label}_1 … {label}_n.
Clashes get a random suffix per item, with a warning.
n : int
Number of copies (>= 1).
dx, dy, dz : float
Per-step translation increment.
Returns¶
list[Part]
n new Parts, each with its translated geometry baked
into its own STEP file.
Source code in src/apeGmsh/core/_part_edit.py
pattern_polar ¶
pattern_polar(*, label: str, n: int, axis: tuple[float, float, float], total_angle: float, center: tuple[float, float, float] = (0.0, 0.0, 0.0)) -> list['Part']
Create n rotated copies around an axis.
Each copy i (1..n) is rotated by i * total_angle / n
about the axis through center. total_angle is in
radians. For a full revolution use total_angle=2*pi;
for n=4 evenly spaced this gives 90° increments.
Source Part must be non-active.
Parameters¶
label : str
Base name; copies labeled {label}_1 … {label}_n.
n : int
Number of copies.
axis : (ax, ay, az)
Rotation axis direction.
total_angle : float
Total swept angle in radians (last copy at this angle).
center : (cx, cy, cz), default (0, 0, 0)
Point on the rotation axis.
Source code in src/apeGmsh/core/_part_edit.py
align_to ¶
align_to(other: 'Part', *, source: str, target: str, on: 'str | tuple[str, ...]', offset: float = 0.0) -> 'PartEdit'
Translate this Part so its source label aligns with
other's target label along the chosen axes.
Computes source centroid in this Part's live session,
reads target centroid from other's STEP sidecar (so
other must have been saved — auto-persist counts), then
applies the masked translation via :meth:translate.
Parameters¶
other : Part
Reference Part. Must have a saved sidecar (has_file
true and a .apegmsh.json written next to the STEP).
Passing an Instance is rejected — use
:meth:Instance.edit.align_to for the assembly side.
source : str
Label name on this Part (the feature that moves).
target : str
Label name on other (the feature it lands on).
on : {"x", "y", "z", "all"} or iterable of those
Axes on which to match centroids. Other axes untouched.
offset : float, default 0.0
Signed gap along the single on axis. Combining a
non-zero offset with multi-axis on raises ValueError.
Returns¶
PartEdit
self for chaining.
Raises¶
RuntimeError
If this Part is not active or other has no sidecar.
TypeError
If other is not a Part (e.g. an Instance).
LookupError
If source or target cannot be resolved.
Source code in src/apeGmsh/core/_part_edit.py
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
align_to_point ¶
align_to_point(point: tuple[float, float, float], *, source: str, on: 'str | tuple[str, ...]', offset: float = 0.0) -> 'PartEdit'
Translate this Part so its source label centroid lands
at point along the chosen axes.
Like :meth:align_to but the target is a coordinate rather
than another Part's labeled feature. No sidecar lookup
needed.
Parameters¶
point : (px, py, pz)
World point in this Part's local frame (i.e. the same
frame in which source lives).
source : str
Label on this Part.
on : {"x", "y", "z", "all"} or iterable
Axes to align.
offset : float, default 0.0
Signed gap along the single on axis.
Source code in src/apeGmsh/core/_part_edit.py
Instance edit composite — inst.edit¶
apeGmsh.core._instance_edit.InstanceEdit ¶
Operations on a placed :class:Instance. Registered as inst.edit.
Source code in src/apeGmsh/core/_instance_edit.py
translate ¶
Translate the instance by (dx, dy, dz).
Returns self for chaining.
Source code in src/apeGmsh/core/_instance_edit.py
rotate ¶
rotate(angle: float, ax: float, ay: float, az: float, *, center: tuple[float, float, float] = (0.0, 0.0, 0.0)) -> 'InstanceEdit'
Rotate the instance by angle (radians) about an axis.
See :meth:Part.edit.rotate for the parameter reference.
Source code in src/apeGmsh/core/_instance_edit.py
mirror ¶
mirror(*, plane: str | None = None, normal: tuple[float, float, float] | None = None, point: tuple[float, float, float] = (0.0, 0.0, 0.0)) -> 'InstanceEdit'
Reflect the instance across a plane.
See :meth:Part.edit.mirror for the parameter reference.
Source code in src/apeGmsh/core/_instance_edit.py
scale ¶
Uniform scale by factor about center.
Source code in src/apeGmsh/core/_instance_edit.py
dilate ¶
dilate(sx: float, sy: float, sz: float, *, center: tuple[float, float, float] = (0.0, 0.0, 0.0)) -> 'InstanceEdit'
Non-uniform scale by (sx, sy, sz) about center.
Source code in src/apeGmsh/core/_instance_edit.py
affine ¶
Apply a general 4×4 affine transform.
See :meth:Part.edit.affine for the parameter reference.
Source code in src/apeGmsh/core/_instance_edit.py
delete ¶
Remove the instance's entities from the assembly session
and unregister from g.parts._instances.
After delete(), subsequent calls on this edit object
raise RuntimeError. The label is freed and may be reused
by a fresh parts.add().
Source code in src/apeGmsh/core/_instance_edit.py
copy ¶
Duplicate this instance's geometry into a new Instance.
Uses gmsh.model.occ.copy() to clone the dimtags (the new
entities live in the same assembly session). All Part-level
labels carried by this instance are recreated under the new
instance's label prefix — so e.g. b1.top_flange becomes
b2.top_flange on the copy.
Parameters¶
label : str, required New instance label. If the requested label is already taken in this session, a 4-character random hex suffix is appended and a warning emitted.
Returns¶
Instance
The new Instance, registered in g.parts and ready
for further edits.
Raises¶
RuntimeError
If this instance has already been deleted.
ValueError
If label is empty.
Source code in src/apeGmsh/core/_instance_edit.py
pattern_linear ¶
Create n translated copies of this instance.
Each copy i (1..n) is shifted by (i*dx, i*dy, i*dz)
from the source. The source itself is not modified.
Returns a list of n new :class:Instance objects, all
registered in g.parts.
Source code in src/apeGmsh/core/_instance_edit.py
pattern_polar ¶
pattern_polar(*, label: str, n: int, axis: tuple[float, float, float], total_angle: float, center: tuple[float, float, float] = (0.0, 0.0, 0.0)) -> list['Instance']
Create n rotated copies of this instance.
Each copy i (1..n) is rotated by i * total_angle / n
about axis through center. total_angle is in
radians (2*pi for a full revolution).
Source code in src/apeGmsh/core/_instance_edit.py
align_to ¶
align_to(other: 'Instance', *, source: str, target: str, on: 'str | tuple[str, ...]', offset: float = 0.0) -> 'InstanceEdit'
Translate this instance so its source label aligns
with other's target label along the chosen axes.
Both instances must live in the same session (the assembly). Both centroids are read live from gmsh — no sidecar lookup needed.
Parameters¶
other : Instance
Reference instance. Cross-Part alignment is rejected
(Parts live in their own sessions; use Part.edit.align_to
instead).
source : str
Label suffix on this instance (e.g. "top_flange").
Resolved to f"{self.label}.{source}".
target : str
Label suffix on other, resolved to
f"{other.label}.{target}".
on : {"x","y","z","all"} or iterable
Axes on which to match centroids.
offset : float, default 0.0
Signed gap along the (single) on axis.
Returns¶
InstanceEdit
self for chaining.
Source code in src/apeGmsh/core/_instance_edit.py
align_to_point ¶
align_to_point(point: tuple[float, float, float], *, source: str, on: 'str | tuple[str, ...]', offset: float = 0.0) -> 'InstanceEdit'
Translate this instance so its source label centroid
lands at point along the chosen axes.
Source code in src/apeGmsh/core/_instance_edit.py
Labels¶
apeGmsh.core.Labels.Labels ¶
Bases: _HasLogging
Geometry-time entity naming composite (g.labels).
Backed by Gmsh physical groups with an internal _label:
prefix. See the module docstring for the two-tier naming
architecture.
Source code in src/apeGmsh/core/Labels.py
add ¶
Create a label for the given entities.
If a label with the same name and dimension already exists, the tags are merged into the existing PG rather than creating a duplicate.
Parameters¶
dim : int Entity dimension (0–3). tags : list[int] Entity tags to label. name : str Human-readable label name (without prefix).
Returns¶
int The Gmsh physical-group tag backing this label.
Source code in src/apeGmsh/core/Labels.py
entities ¶
Return entity tags for a label.
Parameters¶
name : str
Label name (without prefix).
dim : int, optional
Restrict to a single dimension. When None, searches
all dimensions. If the label exists at exactly one
dimension, returns those entities. If it exists at
multiple dimensions, raises ValueError asking the
caller to specify dim=.
Returns¶
list[int] Entity tags.
Raises¶
KeyError
When no label with this name exists.
ValueError
When dim=None and the label exists at multiple
dimensions.
Source code in src/apeGmsh/core/Labels.py
get_all ¶
Return all label names (without prefix).
Parameters¶
dim : int, default -1
Filter by dimension. -1 returns all dimensions.
Source code in src/apeGmsh/core/Labels.py
summary ¶
DataFrame describing every label in the model.
Mirrors :meth:PhysicalGroups.summary but returns only the
internal label PGs (with the _label: prefix stripped).
Returns¶
pd.DataFrame indexed by (dim, pg_tag) with columns
name, n_entities, entity_tags.
Source code in src/apeGmsh/core/Labels.py
has ¶
Return True if a label with this name exists.
remove ¶
Delete a label (and its backing physical group).
Parameters¶
name : str Label name (without prefix). dim : int, optional Restrict to a single dimension. When None, removes the label at all dimensions where it exists.
Raises¶
KeyError When no label with this name exists.
Source code in src/apeGmsh/core/Labels.py
rename ¶
Rename a label in place, preserving its entity membership.
Parameters¶
old_name : str Current label name (without prefix). new_name : str New label name (without prefix). dim : int, optional Restrict to a single dimension. When None, renames the label at all dimensions where it exists.
Raises¶
KeyError When no label with old_name exists.
Source code in src/apeGmsh/core/Labels.py
promote_to_physical ¶
Copy a label's entities into a solver-facing physical group.
The label remains intact — this is a copy, not a move.
The new PG is visible to g.physical, fem.physical,
and the OpenSees exporter.
Parameters¶
label_name : str Label to promote. pg_name : str, optional Name for the new physical group. Defaults to the label name (without prefix). dim : int, optional Dimension to promote. Required when the label exists at multiple dimensions.
Returns¶
int Physical-group tag of the new PG.
Source code in src/apeGmsh/core/Labels.py
reverse_map ¶
Build a (dim, tag) -> label_name reverse lookup.
Useful when callers need to find labels for many entities at
once without repeated entities() calls.
Parameters¶
dim : int, default -1
Filter by dimension. -1 returns all dimensions.
Source code in src/apeGmsh/core/Labels.py
labels_for_entity ¶
Return all label names that contain the given entity.