Skip to content

Add polygon region examples and python-script-writer agent docs#135

Closed
Copilot wants to merge 5 commits intonext-major-releasefrom
copilot/add-polygon-grid-filters
Closed

Add polygon region examples and python-script-writer agent docs#135
Copilot wants to merge 5 commits intonext-major-releasefrom
copilot/add-polygon-grid-filters

Conversation

Copy link
Contributor

Copilot AI commented Mar 5, 2026

Adds two new rips workflow examples for polygon-based grid region assignment, plus an agent instruction document to guide future Python script authoring.

New examples

  • polygon_grid_region.py — creates N polygons programmatically from bounding-box coordinates, adds them to the project's PolygonCollection, then writes a GENERATED property POLYGON_REGION assigning each active cell a 1-based region index via 2D ray-casting.

  • polygon_region_from_project.py — reads polygons already present in the project and applies the same region-assignment logic:

polygon_collection = resinsight.project.descendants(rips.PolygonCollection)[0]
polygons = polygon_collection.polygons()
# ...
case.set_active_cell_property(region_values, "GENERATED", "POLYGON_REGION", 0)
view.apply_cell_result(result_type="GENERATED", result_variable="POLYGON_REGION")

Both examples are wired into PythonExamples_case_and_grid_operations.rst.

Agent instructions

  • agents/python-script-writer.md — describes script skeleton, error-guard conventions, polygon patterns (create vs. read), cell property I/O, descendants() navigation, and style rules. References https://api.resinsight.org throughout.
  • CLAUDE.md — updated to advertise the new agent alongside the existing docs-writer.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: magnesj <1793152+magnesj@users.noreply.github.com>
Copilot AI changed the title [WIP] Add polygon definitions and grid filters Add polygon-based grid region example to Python API docs Mar 5, 2026
…ygons

Co-authored-by: magnesj <1793152+magnesj@users.noreply.github.com>
Copilot AI changed the title Add polygon-based grid region example to Python API docs Add Python examples for polygon-based grid region assignment Mar 5, 2026
Co-authored-by: magnesj <1793152+magnesj@users.noreply.github.com>
Copilot AI changed the title Add Python examples for polygon-based grid region assignment Add polygon region examples and python-script-writer agent docs Mar 5, 2026
Updates the agent to prioritize using tools for discovering and reading existing examples in the repository instead of relying on embedded code snippets. Reorganizes instructions into tables for better readability and updates API reference URLs to include the development branch.
@magnesj magnesj closed this Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants