René's URL Explorer Experiment


Title: Bonsai: ortho_view_frame treats ortho_scale as the width, so the frame of a portrait drawing is wrong · Issue #10110 · IfcOpenShell/IfcOpenShell · GitHub

Open Graph Title: Bonsai: ortho_view_frame treats ortho_scale as the width, so the frame of a portrait drawing is wrong · Issue #10110 · IfcOpenShell/IfcOpenShell

X Title: Bonsai: ortho_view_frame treats ortho_scale as the width, so the frame of a portrait drawing is wrong · Issue #10110 · IfcOpenShell/IfcOpenShell

Description: Bug Description BIMCameraProperties.get_scale_and_aspect_ratio (src/bonsai/bonsai/bim/module/drawing/prop.py, line 722) sets ortho_scale = max(width, height), and update_camera_resolution (lines 701–712) sizes the raster accordingly. So ...

Open Graph Description: Bug Description BIMCameraProperties.get_scale_and_aspect_ratio (src/bonsai/bonsai/bim/module/drawing/prop.py, line 722) sets ortho_scale = max(width, height), and update_camera_resolution (lines 70...

X Description: Bug Description BIMCameraProperties.get_scale_and_aspect_ratio (src/bonsai/bonsai/bim/module/drawing/prop.py, line 722) sets ortho_scale = max(width, height), and update_camera_resolution (lines 70...

Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/issues/10110

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bonsai: ortho_view_frame treats ortho_scale as the width, so the frame of a portrait drawing is wrong","articleBody":"### Bug Description\n\n`BIMCameraProperties.get_scale_and_aspect_ratio` (`src/bonsai/bonsai/bim/module/drawing/prop.py`, line 722) sets `ortho_scale = max(width, height)`, and `update_camera_resolution` (lines 701–712) sizes the raster accordingly. So for a drawing that is taller than it is wide, `ortho_scale` is the **height**.\n\n`helper.ortho_view_frame` (`src/bonsai/bonsai/bim/module/drawing/helper.py`, lines 497–518) always uses it as the **width**:\n\n```python\naspect = props.raster_y / props.raster_x\nsize = camera.ortho_scale\nhwidth = size * 0.5\nhheight = size * 0.5 * aspect\n```\n\nFor a portrait drawing both half-sizes come out too large by the aspect ratio. A 3 × 20 m section gets a frame of x ±10 m (instead of ±1.5 m) and y ±66.7 m (instead of ±10 m).\n\n### Effect\n\n`ortho_view_frame` is used to place the automatic references (`src/bonsai/bonsai/tool/drawing.py`, lines 1720, 1835, 2013, 2017):\n\n- storey level marks (`generate_storey_points`) are drawn across x ±10 m, far outside the drawing, and storeys well above or below the view still get a mark because the y test uses ±66.7 m;\n- grid and section reference lines are clipped to the wrong box.\n\nLandscape and square drawings are not affected. We noticed it on a tall section: the storey level marks ended up outside the sheet. The attached screenshot shows a 3 × 12 m section in Bonsai 0.9.1: the storey marks run across ±6 m.\n\n### Reproduction\n\nThe script below runs Bonsai's unmodified `get_scale_and_aspect_ratio`, `update_camera_resolution` and `ortho_view_frame` with stand-ins for `bpy` and `tool`, without Blender:\n\n```python\n# Runs Bonsai's unmodified camera sizing and ortho_view_frame, without Blender.\n# Usage: python check_ortho_view_frame.py path/to/src/bonsai/bonsai\nimport ast, sys, textwrap, types\nroot = sys.argv[1]\ndef grab(path, names):\n    src = open(f\"{root}/{path}\", encoding=\"utf-8\").read()\n    return {n.name: textwrap.dedent(ast.get_source_segment(src, n))\n            for n in ast.walk(ast.parse(src)) if isinstance(n, ast.FunctionDef) and n.name in names}\nhelper = grab(\"bim/module/drawing/helper.py\", {\"ortho_view_frame\"})\nprop = grab(\"bim/module/drawing/prop.py\", {\"update_camera_resolution\", \"get_scale_and_aspect_ratio\"})\n\nclass Props:\n    dpi = 75\n    def __init__(self, w, h): self.width, self.height = w, h\nclass Camera:\n    clip_start, clip_end = 0.0, 10.0\n    def __init__(self, props): self.props = props; props.id_data = self\ntool = types.SimpleNamespace(Drawing=types.SimpleNamespace(\n    get_camera_props=lambda cam: cam.props, get_diagram_scale=lambda cam: {\"Scale\": \"1/50\"},\n    get_scale_ratio=lambda s: 1 / 50))\nns = {\"tool\": tool, \"bpy\": types.SimpleNamespace(types=types.SimpleNamespace(Camera=Camera)),\n      \"parse_diagram_scale\": lambda camera: 1 / 50}\nfor code in (*prop.values(), *helper.values()):\n    exec(code, ns)\nProps.update_camera_resolution = ns[\"update_camera_resolution\"]\nProps.get_scale_and_aspect_ratio = ns[\"get_scale_and_aspect_ratio\"]\n\nfor w, h in ((20.0, 3.0), (3.0, 20.0)):\n    p = Props(w, h); cam = Camera(p); p.update_camera_resolution()\n    xmin, xmax, ymin, ymax = ns[\"ortho_view_frame\"](cam, margin=0.0)[:4]\n    ok = abs((xmax - xmin) - w) \u003c 0.01 * w and abs((ymax - ymin) - h) \u003c 0.01 * h  # raster is rounded to pixels\n    print(f\"{'OK   ' if ok else 'WRONG'} drawing {w:g} x {h:g} m, ortho_scale {cam.ortho_scale:g}: \"\n          f\"frame x {xmin:+.2f}..{xmax:+.2f}, y {ymin:+.2f}..{ymax:+.2f}\")\n```\n\nOutput on `v0.9.0` at 28bae19 (2026-10-30):\n\n```\nOK    drawing 20 x 3 m, ortho_scale 20: frame x -10.00..+10.00, y -1.50..+1.50\nWRONG drawing 3 x 20 m, ortho_scale 20: frame x -10.00..+10.00, y -66.72..+66.72\n```\n\n### Expected\n\nThe frame matches the drawing's width and height, whichever is larger.\n\n### Possible fix\n\n```diff\n     aspect = props.raster_y / props.raster_x\n     size = camera.ortho_scale\n-    hwidth = size * 0.5\n-    hheight = size * 0.5 * aspect\n+    # ortho_scale is the larger of width and height (see BIMCameraProperties.get_scale_and_aspect_ratio)\n+    if aspect \u003c= 1:\n+        hwidth = size * 0.5\n+        hheight = size * 0.5 * aspect\n+    else:\n+        hheight = size * 0.5\n+        hwidth = size * 0.5 / aspect\n```\n\nWith this the script prints `OK` for both drawings. It sits next to the lines #8972 changes (the margin), so whichever lands second may need a small rebase. Happy to turn this into a PR if that helps.\n\n*The reproduction script and the fix were prepared with the help of an AI assistant and checked by me.*\n\n\u003cimg width=\"800\" height=\"793\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/306fc430-3249-489c-9f69-c57dc668a5d6\" />\n\nBonsai 0.9.1-alpha261027 (IfcOpenShell 0.9.1a261027), Blender 5.2.0 LTS, Windows\nCode checked on v0.9.0 at 28bae19 (2026-10-30)\n\n### Attachments\n\n_No response_\n\n### Debug and Error Output\n\n```true\n\n```","author":{"url":"https://github.com/SautaRoc","@type":"Person","name":"SautaRoc"},"datePublished":"2026-10-31T09:33:24Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/10110"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:36b4a0a0-42b3-6ebc-d14a-9539efd8bdec
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8196:24C069:15E917:1E35C8:6B0465A2
html-safe-nonce5c3504db4e3510721b9d618e0dc5501073a0b465b75f626630c28b173656e2c4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MTk2OjI0QzA2OToxNUU5MTc6MUUzNUM4OjZCMDQ2NUEyIiwidmlzaXRvcl9pZCI6IjU4MDI2NTQ3ODg5NzQwNDQ1NzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac79364e4a73663c8b27197a128621a5fb190880f3203996497ec96e97c7d9bba1
hovercard-subject-tagissue:6133367306
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/IfcOpenShell/IfcOpenShell/10110/issue_layout
twitter:imagehttps://opengraph.githubassets.com/0d33512ef296401dccc9a45eb97d865d1346face9fb5bd09acaccf04b4616ff2/IfcOpenShell/IfcOpenShell/issues/10110
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/0d33512ef296401dccc9a45eb97d865d1346face9fb5bd09acaccf04b4616ff2/IfcOpenShell/IfcOpenShell/issues/10110
og:image:altBug Description BIMCameraProperties.get_scale_and_aspect_ratio (src/bonsai/bonsai/bim/module/drawing/prop.py, line 722) sets ortho_scale = max(width, height), and update_camera_resolution (lines 70...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameSautaRoc
hostnamegithub.com
expected-hostnamegithub.com
None83e4c0e58c5162177f3c161c5fbad38527ae04c11ac14980f9f9d85ae2027b1f
turbo-cache-controlno-preview
go-importgithub.com/IfcOpenShell/IfcOpenShell git https://github.com/IfcOpenShell/IfcOpenShell.git
octolytics-dimension-user_id13692563
octolytics-dimension-user_loginIfcOpenShell
octolytics-dimension-repository_id40473201
octolytics-dimension-repository_nwoIfcOpenShell/IfcOpenShell
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id40473201
octolytics-dimension-repository_network_root_nwoIfcOpenShell/IfcOpenShell
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseca4d07a7cef4e4b75f821dc25e7300d80c1450a9
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/IfcOpenShell/IfcOpenShell/issues/10110#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FIfcOpenShell%2FIfcOpenShell%2Fissues%2F10110
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FIfcOpenShell%2FIfcOpenShell%2Fissues%2F10110
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=IfcOpenShell%2FIfcOpenShell
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/10110
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/10110
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/10110
IfcOpenShellhttps://github.com/IfcOpenShell
IfcOpenShellhttps://github.com/IfcOpenShell/IfcOpenShell
Codehttps://github.com/IfcOpenShell/IfcOpenShell
Issues1.2k (1.2k)https://github.com/IfcOpenShell/IfcOpenShell/issues
Pull requests936 (936)https://github.com/IfcOpenShell/IfcOpenShell/pulls
Discussionshttps://github.com/IfcOpenShell/IfcOpenShell/discussions
Actionshttps://github.com/IfcOpenShell/IfcOpenShell/actions
Projectshttps://github.com/IfcOpenShell/IfcOpenShell/projects
Wikihttps://github.com/IfcOpenShell/IfcOpenShell/wiki
Security and qualityhttps://github.com/IfcOpenShell/IfcOpenShell/security
Insightshttps://github.com/IfcOpenShell/IfcOpenShell/insights
https://github.com/IfcOpenShell/IfcOpenShell
New issuehttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/10110
New issuehttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/10110
Bughttps://github.com/IfcOpenShell/IfcOpenShell/issues?q=type:"Bug"
#10276https://github.com/IfcOpenShell/IfcOpenShell/pull/10276
Bonsai: ortho_view_frame treats ortho_scale as the width, so the frame of a portrait drawing is wronghttps://github.com/IfcOpenShell/IfcOpenShell/issues/10110#top
#10276https://github.com/IfcOpenShell/IfcOpenShell/pull/10276
https://github.com/SautaRoc
SautaRochttps://github.com/SautaRoc
on Oct 31, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/10110#issue-6133367306
28bae19https://github.com/IfcOpenShell/IfcOpenShell/commit/28bae192780ebd34936441f1f7bc1ffb9d282be9
#8972https://github.com/IfcOpenShell/IfcOpenShell/pull/8972
https://private-user-images.githubusercontent.com/243786177/690952192-306fc430-3249-489c-9f69-c57dc668a5d6.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTU0NTA1NzQsIm5iZiI6MTc5NTQ1MDI3NCwicGF0aCI6Ii8yNDM3ODYxNzcvNjkwOTUyMTkyLTMwNmZjNDMwLTMyNDktNDg5Yy05ZjY5LWM1N2RjNjY4YTVkNi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYxMTIzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MTEyM1QxNjExMTRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT02MjU5YjNiYTgzM2E0ODk1ZDJkOTllMzc2NTU1NzkyM2I0NTlhYjM2YWExN2ZkODczMmE3ZDUzZDc5NGY0ZjEyJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZyZXNwb25zZS1jb250ZW50LXR5cGU9aW1hZ2UlMkZwbmcifQ.me3CL4Kgg3kCD-e0yVZfdvpty3BsxslQdhx2lBiZh70
28bae19https://github.com/IfcOpenShell/IfcOpenShell/commit/28bae192780ebd34936441f1f7bc1ffb9d282be9
SautaRochttps://github.com/SautaRoc
Bughttps://github.com/IfcOpenShell/IfcOpenShell/issues?q=type:"Bug"
on Oct 31, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/10110#event-34764336713
3adoshkahttps://github.com/3adoshka
on Nov 19, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/10110#event-36714013640
fix(bonsai): compute ortho_view_frame dimensions for portrait drawings (https://github.com/3adoshka/IfcOpenShell/commit/6f27e867d6f1d71f6339e6cefd41810dd1326a29
6f27e86https://github.com/3adoshka/IfcOpenShell/commit/6f27e867d6f1d71f6339e6cefd41810dd1326a29
https://github.com/3adoshka
3adoshkahttps://github.com/3adoshka
on Nov 19, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/10110#issuecomment-7025656098
#10276https://github.com/IfcOpenShell/IfcOpenShell/pull/10276
Sign up for freehttps://github.com/signup?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/10110
Sign in to commenthttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/10110
Bughttps://github.com/IfcOpenShell/IfcOpenShell/issues?q=type:"Bug"
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.