<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Boueslati on Medium]]></title>
        <description><![CDATA[Stories by Boueslati on Medium]]></description>
        <link>https://medium.com/@boueslati76?source=rss-c65ef73ee7ec------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*FJEEtajbzz7GQb-BOI8zvg.jpeg</url>
            <title>Stories by Boueslati on Medium</title>
            <link>https://medium.com/@boueslati76?source=rss-c65ef73ee7ec------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 00:28:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@boueslati76/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[GCode-preview angular 11 Exemple]]></title>
            <link>https://medium.com/@boueslati76/gcode-preview-angular-11-exemple-fc3fe9dcf709?source=rss-c65ef73ee7ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc3fe9dcf709</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[g-code]]></category>
            <category><![CDATA[exemple]]></category>
            <dc:creator><![CDATA[Boueslati]]></dc:creator>
            <pubDate>Wed, 01 Sep 2021 02:52:18 GMT</pubDate>
            <atom:updated>2021-09-01T09:48:08.363Z</atom:updated>
            <content:encoded><![CDATA[<p>In this tutorial , you will learn how to use gcode-preview npm package at angular11 project.</p><p>GCode-preview package is used for the display of the prototype from file .gcode in 3D view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*MMGiCpJbYt5CGc0m5c0GoA.png" /><figcaption>Final view Of our project</figcaption></figure><p>At the first, create angular project and then install GCode-preview package</p><p>by typing : npm install gcode-preview</p><p>then for app.component.html just write the following code</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/329/1*vwHIXEIi3yxffKnVU_zGxg.png" /></figure><p>for the app.component.ts :</p><p>1- declare the viewChild for canvas element as variable</p><p>2- implement AfterViewInit interface and add the method ngAfterViewInit that create WebGLPreview instance as shown bellow</p><p>ngAfterViewInit will be invoked immediately after Angular has completed initialization of a component’s view and the ViewChild will not be null</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*GO562mrFwMq2iZnMrVnInw.png" /></figure><p>note that the targetId should be the same value of the div Id declared at app.component.html,</p><p>I use also THREE package for changing the color of the top layer and the last segment, you can add it by typing “npm i three” , the build volume describe the size of the cube .</p><p>render() method will create WebGLPreview into canvas and display the cube.</p><p>3- create fetchGcode method that read all ligne from file and set it into table</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*gahFvwlkFzDg2cZ9GxPsQA.png" /></figure><p>4- the last method for our Preview Part is Loading it By Chunked</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*IGUP8iWy5K_ITaeyRg0j8Q.png" /></figure><p>this method will create chunk and then call to processGCode at recursive way for the display of all slice</p><p>Important note : the recursive method “loadProgressive” Consume a lot of memorie Resource (RAM) so loading gcode file with large size may break your browser ( this code was tested with file under public directory, just check the link of github project )</p><p>5- the last part in this tutorial is creating upload file button , so we should type at the first “npm i ngx-file-drop” and then import it into app.module.ts ,</p><p>for the app.component.html we will add the code bellow</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*ukIrbGlBK27KNsUZZoC2fg.png" /></figure><p>and for the app.components.ts , add the method for reading file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*5ymFtHxLNVCxiB8jlkl6zg.png" /></figure><p>you can find the exemple at github :</p><p><a href="https://github.com/oueslati00/preview-gcode">https://github.com/oueslati00/preview-gcode</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc3fe9dcf709" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>