René's URL Explorer Experiment


Title: Proposal on how to pass clipping planes info by cvillagrasa · Pull Request #3774 · IfcOpenShell/IfcOpenShell · GitHub

Open Graph Title: Proposal on how to pass clipping planes info by cvillagrasa · Pull Request #3774 · IfcOpenShell/IfcOpenShell

X Title: Proposal on how to pass clipping planes info by cvillagrasa · Pull Request #3774 · IfcOpenShell/IfcOpenShell

Description: Hi @Moult , this is linked to question 4 from here, and some little fights I'm having with the current API, which make me interested in improving it. Let's see if you like the angle of this PR, or maybe you'd go in another direction. It consists of a very simple idea to begin with: to just pass a location and a normal vector in order to generate a clipping plane, instead of a whole matrix in which X and Y vectors are going to be ignored. However, I also feel like passing a simple dict, without any definition and/or validation is what was making things difficult in the first place. So in order to address that, I defined a TypedDict during an initial attempt. Nonetheless, without NotRequired and Unpack from Python 3.11, it's quite unusable. Furthermore, some factory method can be added to validate the dict, but that kind of defeats the purpose of its simplicity to begin with. So to me, this was screaming dataclass. Consequently, I defined a ClippingInfo dataclass and placed it under util.representation. Another thing, I really miss are type hints. They really help to quickly understand the code, and with which args should the API method be called. In addition, the same issue described above happens with the Usecase classes, specially their arguments. I've tried to think of why the settings dict was being used, but couldn't figure it out. So I tried a dataclass instead (for the geometry.add_wall_representation case), expecting maybe to find the reason, but it just works. Curious to learn the underlying reason if I've missed it. So with the dataclass also in the Usecase, default values can be super easily defined. I've also added some manual validation methods, which don't cover everything, but do cover 100% of their scope. Meaning that they issue a warning if any data has an unexpected format and is going to be ignored. I feel this is super important in general, since as it is now, invalid arguments are ignored silently, making the user have a harder time chasing issues. At the same time, it's not a Pydantic BaseModel validating everything and adding significant overhead, the overhead of a slotted dataclass is negligible. And as it is in this proposal, the dev chooses what to validate (namely, correct keys of dicts or correct classes of entity_instances). In case this is acceptable, it can be extended to add_profile_representation, add_slab_representation and their respective calls from BlenderBIM, using a dict with "location" and "normal", instead of with "matrix". And of course, the conversion of the Usecase could be extended to the whole API. Is there any interference with Sphinx, maybe? When you have availability, let me know what you think of this, and if there's any drawback concerning dataclasses or type hints I haven't seen. We can screenshare if needed.

Open Graph Description: Hi @Moult , this is linked to question 4 from here, and some little fights I'm having with the current API, which make me interested in improving it. Let's see if you like the angle of this...

X Description: Hi @Moult , this is linked to question 4 from here, and some little fights I'm having with the current API, which make me interested in improving it. Let's see if you like the angle...

Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/pull/3774

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3

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/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:1e9491ce-354a-ca07-f3c8-6c64a7076366
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id8E76:D7B7D:46442B:5DF44F:6B04F4D3
html-safe-nonce09211fd36f2829506d254f73ccb3b7c7a1959022542d10459d2cd80c90c663a3
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RTc2OkQ3QjdEOjQ2NDQyQjo1REY0NEY6NkIwNEY0RDMiLCJ2aXNpdG9yX2lkIjoiMTI3ODU1OTMwNzA4NDEzMzU4NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac869544374118d8517fae343d7a4cc6232dc7764a9a12bf4b4566036c7b3b4384
hovercard-subject-tagpull_request:1521692205
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files
twitter:imagehttps://avatars.githubusercontent.com/u/57069798?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/57069798?s=400&v=4
og:image:altHi @Moult , this is linked to question 4 from here, and some little fights I'm having with the current API, which make me interested in improving it. Let's see if you like the angle of this...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None2c3971d6ab4be607cf9a26ac26ef0a7bfce380ec2ba14642e64028ad07a492b9
turbo-cache-controlno-preview
diff-viewunified
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 full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseb3f1d45dee14b3f87c64e9017a9c08d011561786
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FIfcOpenShell%2FIfcOpenShell%2Fpull%2F3774%2Ffiles
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%2Fpull%2F3774%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=IfcOpenShell%2FIfcOpenShell
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files
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
Sign up for GitHub https://github.com/signup?return_to=%2FIfcOpenShell%2FIfcOpenShell%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FIfcOpenShell%2FIfcOpenShell%2Fissues%2Fnew%2Fchoose
cvillagrasahttps://github.com/cvillagrasa
IfcOpenShell:v0.7.0https://github.com/IfcOpenShell/IfcOpenShell/tree/v0.7.0
cvillagrasa:rethink_matriceshttps://github.com/cvillagrasa/IfcOpenShell/tree/rethink_matrices
Conversation 12 https://github.com/IfcOpenShell/IfcOpenShell/pull/3774
Commits 5 https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/commits
Checks 0 https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/checks
Files changed https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files
Please reload this pagehttps://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files
Proposal on how to pass clipping planes info https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#top
Show all changes 5 commits https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files
f7fbb62 Remove redundant RefDirection on IfcPlanes cvillagrasa Sep 18, 2023 https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/commits/f7fbb621e8e2c9691dd21a376f0d1999371574f9
8c30fe8 Refactor clipping logic into its own class, using dataclasses cvillagrasa Sep 19, 2023 https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/commits/8c30fe8b19d15bd74ff33925e37b840981e563c7
23ac92e Merge branch 'v0.7.0' into rethink_matrices cvillagrasa Sep 19, 2023 https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/commits/23ac92efda7c6ba7453bc23d220507e26228f9d5
9a0188d Add strict validation flag cvillagrasa Sep 26, 2023 https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/commits/9a0188d2d12c43bd997e23037f0a2b23c2d9cf64
f7cd544 Merge branch 'v0.7.0' into rethink_matrices cvillagrasa Nov 30, 2023 https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/commits/f7cd544fb0eb958df87a4193f43ab0ae5f0c03d5
Clear filters https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files
Please reload this pagehttps://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files
Please reload this pagehttps://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files
add_profile_representation.py https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-7a94d5cd264d47c35450b66d41993eb982e679b897418ae2ac14e9c3c370c6a3
add_slab_representation.py https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-d86198d6f34dbf22e4d4c45ec187093d69d3b4ce1e2f18692748a8dd1ee2934c
add_wall_representation.py https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-674efb471dc01a3ed604b6f49e73b6e24a170154c2693f477a0bb08781e3fdb8
file.py https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-7bb9f4f41edc728931a8a084e39411fc704d910a650230895371323feee9bca4
representation.py https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-aab3de053b422bed2ce2100c0c4a30df22053cb141ae0b97c54625c65d9cb7f6
unit.py https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-f09f89bf68d6a046d570cdcfee76e1aee4d042533ebd2e4b3cd920e11d68fe3b
src/ifcopenshell-python/ifcopenshell/api/geometry/add_profile_representation.pyhttps://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-7a94d5cd264d47c35450b66d41993eb982e679b897418ae2ac14e9c3c370c6a3
View file https://github.com/cvillagrasa/IfcOpenShell/blob/f7cd544fb0eb958df87a4193f43ab0ae5f0c03d5/src/ifcopenshell-python/ifcopenshell/api/geometry/add_profile_representation.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/{{ revealButtonHref }}
https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-7a94d5cd264d47c35450b66d41993eb982e679b897418ae2ac14e9c3c370c6a3
https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-7a94d5cd264d47c35450b66d41993eb982e679b897418ae2ac14e9c3c370c6a3
src/ifcopenshell-python/ifcopenshell/api/geometry/add_slab_representation.pyhttps://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-d86198d6f34dbf22e4d4c45ec187093d69d3b4ce1e2f18692748a8dd1ee2934c
View file https://github.com/cvillagrasa/IfcOpenShell/blob/f7cd544fb0eb958df87a4193f43ab0ae5f0c03d5/src/ifcopenshell-python/ifcopenshell/api/geometry/add_slab_representation.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/{{ revealButtonHref }}
https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-d86198d6f34dbf22e4d4c45ec187093d69d3b4ce1e2f18692748a8dd1ee2934c
https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-d86198d6f34dbf22e4d4c45ec187093d69d3b4ce1e2f18692748a8dd1ee2934c
src/ifcopenshell-python/ifcopenshell/api/geometry/add_wall_representation.pyhttps://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-674efb471dc01a3ed604b6f49e73b6e24a170154c2693f477a0bb08781e3fdb8
View file https://github.com/cvillagrasa/IfcOpenShell/blob/f7cd544fb0eb958df87a4193f43ab0ae5f0c03d5/src/ifcopenshell-python/ifcopenshell/api/geometry/add_wall_representation.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/{{ revealButtonHref }}
https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-674efb471dc01a3ed604b6f49e73b6e24a170154c2693f477a0bb08781e3fdb8
https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-674efb471dc01a3ed604b6f49e73b6e24a170154c2693f477a0bb08781e3fdb8
https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-674efb471dc01a3ed604b6f49e73b6e24a170154c2693f477a0bb08781e3fdb8
src/ifcopenshell-python/ifcopenshell/file.pyhttps://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-7bb9f4f41edc728931a8a084e39411fc704d910a650230895371323feee9bca4
View file https://github.com/cvillagrasa/IfcOpenShell/blob/f7cd544fb0eb958df87a4193f43ab0ae5f0c03d5/src/ifcopenshell-python/ifcopenshell/file.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/{{ revealButtonHref }}
https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-7bb9f4f41edc728931a8a084e39411fc704d910a650230895371323feee9bca4
https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-7bb9f4f41edc728931a8a084e39411fc704d910a650230895371323feee9bca4
https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-7bb9f4f41edc728931a8a084e39411fc704d910a650230895371323feee9bca4
src/ifcopenshell-python/ifcopenshell/util/representation.pyhttps://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-aab3de053b422bed2ce2100c0c4a30df22053cb141ae0b97c54625c65d9cb7f6
View file https://github.com/cvillagrasa/IfcOpenShell/blob/f7cd544fb0eb958df87a4193f43ab0ae5f0c03d5/src/ifcopenshell-python/ifcopenshell/util/representation.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/{{ revealButtonHref }}
https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-aab3de053b422bed2ce2100c0c4a30df22053cb141ae0b97c54625c65d9cb7f6
https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-aab3de053b422bed2ce2100c0c4a30df22053cb141ae0b97c54625c65d9cb7f6
https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-aab3de053b422bed2ce2100c0c4a30df22053cb141ae0b97c54625c65d9cb7f6
https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-aab3de053b422bed2ce2100c0c4a30df22053cb141ae0b97c54625c65d9cb7f6
src/ifcopenshell-python/ifcopenshell/util/unit.pyhttps://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-f09f89bf68d6a046d570cdcfee76e1aee4d042533ebd2e4b3cd920e11d68fe3b
View file https://github.com/cvillagrasa/IfcOpenShell/blob/f7cd544fb0eb958df87a4193f43ab0ae5f0c03d5/src/ifcopenshell-python/ifcopenshell/util/unit.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/{{ revealButtonHref }}
https://github.com/IfcOpenShell/IfcOpenShell/pull/3774/files#diff-f09f89bf68d6a046d570cdcfee76e1aee4d042533ebd2e4b3cd920e11d68fe3b
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-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.