{"id":1335,"date":"2024-01-06T23:52:12","date_gmt":"2024-01-06T21:52:12","guid":{"rendered":"https:\/\/www.rocworks.at\/wordpress\/?p=1335"},"modified":"2024-01-12T17:06:10","modified_gmt":"2024-01-12T15:06:10","slug":"3d-charts-with-unity3d-and-wincc-unified","status":"publish","type":"post","link":"https:\/\/www.rocworks.at\/wordpress\/?p=1335","title":{"rendered":"3D charts with Unity3D and WinCC Unified"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">With WinCC Unified V19 we got the feature to read history values of logged tags with GraphQL \ud83d\udc4d I have now added this functionality to the<a href=\"https:\/\/u3d.as\/2D88\"> GraphQL for Unity Pro<\/a> Asset \ud83e\udd1d&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Unity3D and WinCC Unified with GraphQL for Unity Pro Asset\" width=\"584\" height=\"329\" src=\"https:\/\/www.youtube.com\/embed\/W42Tfb7H6aA?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83c\udfa5 With that done it is now also very easy to read the history of logged tags in Unity3D. See the <a href=\"https:\/\/youtu.be\/W42Tfb7H6aA?si=uZqC6Z10BPsHKUmK\">video<\/a>, there we read and visualize the history values of a tag when the application starts. And then the 3D chart gets updated with real-time values coming from a GraphQL tag subscription.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u2139\ufe0f The GraphQL for Unity Pro Asset has a WinCC Unified interface on top of GraphQL to make the access to WinCC Unified data in Unity even more easier, you do not need to implement the GraphQL queries by your own.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udc49 You can try the demo in the browser! This is possible because the asset als supports WebGL builds and because GraphQL is transported over HTTP&amp;Websockets. <a href=\"https:\/\/unified.rocworks.at\/unity\/graphql\/\">Here it is.<\/a> But it might happen that this link will not work anymore when you read this post.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Note: Use the PWA WebGL Template so that the application adjusts to the size of your browser window. Or adjust the settings in the generated index.html page:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code> &lt;canvas id=\"unity-canvas\" width=<strong>auto<\/strong> height=<strong>auto<\/strong> tabindex=\"-1\" style=\"<strong>width: 100%; height: 100%<\/strong>; background: #231F20\"&gt;&lt;\/canvas&gt;<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udca1 Get a copy of WinCC Unified, connect your machines to it and build your Unity3D application with the data from WinCC Unified!&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example code how to read the last 100 values of a tag.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Connection.LoggedTagValues(\"PV-Vogler-PC::HMI_Tag_1:LoggingTag_1\",\n&nbsp;&nbsp;&nbsp;endTime:&nbsp;<a href=\"http:\/\/datetime.now\/\">DateTime.Now<\/a>,\n&nbsp;&nbsp;&nbsp;maxNumberOfValues: 100\n).ContinueWith((task) =&gt; {\n   Debug.Log(task.Result.Count); \n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>With WinCC Unified V19 we got the feature to read history values of logged tags with GraphQL \ud83d\udc4d I have now added this functionality to the GraphQL for Unity Pro Asset \ud83e\udd1d&nbsp; \ud83c\udfa5 With that done it is now also &hellip; <a href=\"https:\/\/www.rocworks.at\/wordpress\/?p=1335\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[52],"tags":[48,59,50,64],"class_list":["post-1335","post","type-post","status-publish","format-standard","hentry","category-graphql","tag-graphql","tag-scada","tag-unity3d","tag-winccunified"],"_links":{"self":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1335","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1335"}],"version-history":[{"count":8,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1335\/revisions"}],"predecessor-version":[{"id":1344,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1335\/revisions\/1344"}],"wp:attachment":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1335"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}