René's URL Explorer Experiment


Title: Problem with entity copying · Issue #380 · stepcode/stepcode · GitHub

Open Graph Title: Problem with entity copying · Issue #380 · stepcode/stepcode

X Title: Problem with entity copying · Issue #380 · stepcode/stepcode

Description: Part of my project involves merging parts of multiple STEP files into one. For now I basically want to merge their product shapes, eventually I will need to add various metadata to these products. However, even in the most simplified cas...

Open Graph Description: Part of my project involves merging parts of multiple STEP files into one. For now I basically want to merge their product shapes, eventually I will need to add various metadata to these products. ...

X Description: Part of my project involves merging parts of multiple STEP files into one. For now I basically want to merge their product shapes, eventually I will need to add various metadata to these products. ...

Opengraph URL: https://github.com/stepcode/stepcode/issues/380

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.113.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Problem with entity copying","articleBody":"Part of my project involves merging parts of multiple STEP files into one. For now I basically want to merge their product shapes, eventually I will need to add various metadata to these products.\r\n\r\nHowever, even in the most simplified case – taking a single STEP file and copying over only its `CARTESIAN_POINT` entities (AP242 / AP210e3), I get garbage data in the output roughly every 3-4 runs.\r\n\r\nI can try to produce a minimal example but perhaps it will be sufficient to list the core parts:\r\n\r\n 1. The STEP file is opened, similarly to how it is done in the minimal example.\r\n 2. All of the entities of its instance manager are iterated, and ones whose `EntityName()` matches an entry in the whitelist (so just `\"CARTESIAN_POINT\"`) are replicated using `entity->Replicate()` and added to a map mapping the original entity to the new one (`std::map\u003cSDAI_Application_instance *, SDAI_Application_instance *>`). Keep in mind I will need to make sure entity references are preserved after the STEP merge in the new file, so I need a structure to map the original entities to the new ones.\r\n 3. As far as I can tell, `entity->Replicate()` does a \"shallow\" copy so the attributes point to the exact same memory locations. Because of this I iterate all of the attributes of the entities and adding them to one of two queues. One is for all entity references (`std::queue\u003cSDAI_Application_instance *>`); the other is for all other types, which I stringify using `attr->asStr()` (`std::queue\u003cstd::string>`).\r\n 4. Then I iterate the new replicated entities and their origin's attributes (in the same order as before) so that I can set the attributes of the new entities by reading from the queues in the same order. Entity type attributes read from the first queue, all other read from the second queue and set the attribute value using `attr->StrToVal(strFromQueue)`.\r\n 5. The remapped entities are collected and all appended into the instance manager of a new STEP file, which then writes the output file.\r\n\r\nThe entity reference remapping actually seems to work fine, though it sounds more finicky. But in any case, in the minimal case of copying over only `CARTESIAN_POINT` instances, there are no entity references, since a `CARTESIAN_POINT` is just:\r\n\r\n```\r\nENTITY Cartesian_point\r\n  SUBTYPE OF (Point);\r\n  coordinates : LIST[1:3] OF length_measure;\r\nEND_ENTITY;\r\n\r\nENTITY Point\r\n  ABSTRACT SUPERTYPE \r\n  SUBTYPE OF (Detailed_geometric_model_element);\r\nEND_ENTITY;\r\n\r\nENTITY Detailed_geometric_model_element\r\n  ABSTRACT SUPERTYPE OF (ONEOF (Direction,\r\n                                Axis_placement,\r\n                                Cartesian_transformation_2d,\r\n                                Cartesian_transformation_3d,\r\n                                Geometric_placement_operation))\r\n  SUBTYPE OF (Representation_item);\r\nEND_ENTITY;\r\n\r\nENTITY Representation_item\r\n  ABSTRACT SUPERTYPE ;\r\n  name : OPTIONAL label;\r\nEND_ENTITY;\r\n```\r\n\r\nSo `#1 = CARTESIAN_POINT('', (0.1, 0.2, 0.3));` is a valid instance.\r\n\r\nAm I doing something wrong when restoring the primitive types? Should I do some string copies before adding the result of `asStr()` or before giving a string to `StrToVal()`? As far as I can tell, `STEPattribute` does not store / cache its string representation and `asStr()` seems to create a string using a `std::stringstream`.\r\n\r\nThe concrete case I'm testing is an input file with 256 `CARTESIAN_POINT`s, all of which have a `name` either `''` or `'Origin'` (none of them have `$` in their `name`). When the copy goes wrong, I can see some `CARTESIAN_POINT`s with `$` or even garbage data that is not even valid STEP:\r\n\r\n![screen shot 2018-09-10 at 15 37 12](https://user-images.githubusercontent.com/1102162/45304218-87116080-b50f-11e8-8c0d-92c1d8af113b.png)\r\n\r\nAny ideas? Should I try to reproduce the issue with a minimal example code?\r\n\r\nEdit: One more thing – during the execution of the copy, I do a debug trace of the string values that are passed to `StrToVal()`. They are all either `''` or `'Origin'`, as expected from the source file. This seems to suggest that the string data gets corrupted later.","author":{"url":"https://github.com/AureaNoire","@type":"Person","name":"AureaNoire"},"datePublished":"2018-09-10T14:40:03Z","url":"https://github.com/stepcode/stepcode/issues/380"}

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:492c0c7a-66e3-f4ed-5978-9fadf9dc2767
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC9E2:D7239:1AEBDB:26129A:6B0467D8
html-safe-noncec8946bbdc8ff5e32e789098755c913973e5a78669c8ee5797de386e5cca4196e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOUUyOkQ3MjM5OjFBRUJEQjoyNjEyOUE6NkIwNDY3RDgiLCJ2aXNpdG9yX2lkIjoiMzc5MzgyOTUzODc0MDU5NDY0OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac201de55349ec505b669859329685288a88fb439c8074cfcaf95306025b059aa7
hovercard-subject-tagissue:358654353
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/stepcode/stepcode/380/issue_layout
twitter:imagehttps://opengraph.githubassets.com/1ccd21f008c99ec1d700dc3745ed8ad85030a290ac417e7b36b91fe7720cc69b/stepcode/stepcode/issues/380
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/1ccd21f008c99ec1d700dc3745ed8ad85030a290ac417e7b36b91fe7720cc69b/stepcode/stepcode/issues/380
og:image:altPart of my project involves merging parts of multiple STEP files into one. For now I basically want to merge their product shapes, eventually I will need to add various metadata to these products. ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameAureaNoire
hostnamegithub.com
expected-hostnamegithub.com
None83e4c0e58c5162177f3c161c5fbad38527ae04c11ac14980f9f9d85ae2027b1f
turbo-cache-controlno-preview
go-importgithub.com/stepcode/stepcode git https://github.com/stepcode/stepcode.git
octolytics-dimension-user_id1761770
octolytics-dimension-user_loginstepcode
octolytics-dimension-repository_id1975387
octolytics-dimension-repository_nwostepcode/stepcode
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1975387
octolytics-dimension-repository_network_root_nwostepcode/stepcode
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/stepcode/stepcode/issues/380#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fstepcode%2Fstepcode%2Fissues%2F380
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%2Fstepcode%2Fstepcode%2Fissues%2F380
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=stepcode%2Fstepcode
Reloadhttps://github.com/stepcode/stepcode/issues/380
Reloadhttps://github.com/stepcode/stepcode/issues/380
Reloadhttps://github.com/stepcode/stepcode/issues/380
stepcodehttps://github.com/stepcode
stepcodehttps://github.com/stepcode/stepcode
Codehttps://github.com/stepcode/stepcode
Issues60 (60)https://github.com/stepcode/stepcode/issues
Pull requestshttps://github.com/stepcode/stepcode/pulls
Actionshttps://github.com/stepcode/stepcode/actions
Projectshttps://github.com/stepcode/stepcode/projects
Wikihttps://github.com/stepcode/stepcode/wiki
Security and qualityhttps://github.com/stepcode/stepcode/security
Insightshttps://github.com/stepcode/stepcode/insights
https://github.com/stepcode/stepcode
New issuehttps://github.com/login?return_to=https://github.com/stepcode/stepcode/issues/380
New issuehttps://github.com/login?return_to=https://github.com/stepcode/stepcode/issues/380
Problem with entity copyinghttps://github.com/stepcode/stepcode/issues/380#top
https://github.com/AureaNoire
AureaNoirehttps://github.com/AureaNoire
on Sep 10, 2018https://github.com/stepcode/stepcode/issues/380#issue-358654353
https://user-images.githubusercontent.com/1102162/45304218-87116080-b50f-11e8-8c0d-92c1d8af113b.png
https://github.com/AureaNoire
AureaNoirehttps://github.com/AureaNoire
on Sep 10, 2018https://github.com/stepcode/stepcode/issues/380#issuecomment-419985330
Sign up for freehttps://github.com/signup?return_to=https://github.com/stepcode/stepcode/issues/380
Sign in to commenthttps://github.com/login?return_to=https://github.com/stepcode/stepcode/issues/380
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.