{"id":17243592,"url":"https://github.com/gabotechs/react-gcode-viewer","last_synced_at":"2025-04-14T03:53:19.649Z","repository":{"id":37098888,"uuid":"401790394","full_name":"gabotechs/react-gcode-viewer","owner":"gabotechs","description":"React component for visualizing GCodes in the browser using three.js","archived":false,"fork":false,"pushed_at":"2022-10-30T17:29:48.000Z","size":109079,"stargazers_count":35,"open_issues_count":1,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T11:17:23.950Z","etag":null,"topics":["3d","3d-printing","gcode","printer","react","render","renderer","three","threejs","viewer"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gabotechs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-31T17:34:13.000Z","updated_at":"2025-02-25T16:48:32.000Z","dependencies_parsed_at":"2023-01-19T11:02:47.678Z","dependency_job_id":null,"html_url":"https://github.com/gabotechs/react-gcode-viewer","commit_stats":null,"previous_names":["gabrielmusat/react-gcode-viewer"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabotechs%2Freact-gcode-viewer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabotechs%2Freact-gcode-viewer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabotechs%2Freact-gcode-viewer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabotechs%2Freact-gcode-viewer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gabotechs","download_url":"https://codeload.github.com/gabotechs/react-gcode-viewer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248819365,"owners_count":21166474,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d","3d-printing","gcode","printer","react","render","renderer","three","threejs","viewer"],"created_at":"2024-10-15T06:16:11.930Z","updated_at":"2025-04-14T03:53:19.630Z","avatar_url":"https://github.com/gabotechs.png","language":"TypeScript","readme":"# react-gcode-viewer\n\nReact component for visualizing GCodes using Three.js.\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"docs/demo.gif\"\u003e\n\u003c/p\u003e\n\n## Install\n\n```shell\nnpm install --save react-gcode-viewer\n```\nor\n```shell\nyarn add react-gcode-viewer\n```\n\n## Usage\n\n```js\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport {GCodeViewer} from \"react-gcode-viewer\";\n\nconst url = \"https://storage.googleapis.com/ucloud-v3/6127a7f9aa32f718b8c1ab4f.gcode\"\n\nconst style = {\n    top: 0,\n    left: 0,\n    width: '100vw',\n    height: '100vh',\n}\n\nfunction App() {\n    return (\n        \u003cGCodeViewer\n            orbitControls\n            showAxes\n            style={style}\n            url={url}\n        /\u003e\n    );\n}\n\nReactDOM.render(\u003cApp /\u003e, document.getElementById('root'));\n```\n## Demos\n\nYou can see working the examples from `.storybook/stories` [here](https://gabotechs.github.io/react-gcode-viewer)\n\n## Props\n\n| Prop                    |               Type               | Required |                                                                            Notes                                                                             |\n|-------------------------|:--------------------------------:|:--------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------:|\n| `url`                   |             `string`             |  `true`  |                                                                    url of the GCode file                                                                     |\n| `quality`               |             `number`             | `false`  | (default 1) number between 0 and 1 specifying the render quality, for larger models it's recommended to lower this number, as it consumes a lot of resources |\n| `visible`               |             `number`             | `false`  |                                        (default 1) number between 0 and 1 specifying the percentage of visible layers                                        |\n| `layerColor`            |             `string`             | `false`  |                                                                 (default \"grey\") layer color                                                                 |\n| `topLayerColor`         |             `string`             | `false`  |                                                             (default \"hotpink\") top layer color                                                              |\n| `showAxes`              |            `boolean`             | `false`  |                                                                       show x y z axis                                                                        |\n| `orbitControls`         |            `boolean`             | `false`  |                                                                 enable camera orbit controls                                                                 |\n| `cameraInitialPosition` |     `CameraInitialPosition`      | `false`  |                        set the initial position of the camera in geographic coordinates. The coordinates origin is the object itself                         |\n| `floorProps`            |           `FloorProps`           | `false`  |                                                                 floor properties, see below                                                                  |\n| `reqOptions`            |          `RequestInit`           | `false`  |                      fetch options for customizing the http query made for retrieving the GCode file, only valid if \"url\" is specified                       |\n| `onProgress`            | `(p: GCodeParseProgress) =\u003e any` | `false`  |                                                            callback triggered on parsing progress                                                            |\n| `onFinishLoading`       | `(p: GCodeParseProgress) =\u003e any` | `false`  |                                                        callback triggered when GCode is fully loaded                                                         |\n| `onError`               |      `(err: Error) =\u003e any`       | `false`  |                                                callback triggered when an error occurred while loading GCode                                                 |\n| `canvasId`              |             `string`             | `false`  |                                                    id of the canvas element used for rendering the model                                                     |\n\nThe component also accepts ```\u003cdiv/\u003e``` props\n\n## Interfaces\n\n### FloorProps\n| Prop         |   Type   | Required |                              Notes                               |\n|--------------|:--------:|:--------:|:----------------------------------------------------------------:|\n| `gridWidth`  | `number` | `false`  | if specified, a grid will be drawn in the floor with this width  |\n| `gridLength` | `number` | `false`  | if specified, a grid will be drawn in the floor with this length |\n\n### GCodeParseProgress\n| Prop             |                Type                 |                  Notes                  |\n|------------------|:-----------------------------------:|:---------------------------------------:|\n| `read`           |              `number`               |    number of bytes read from the url    |\n| `baseCenter`     |      `{x: number, y: number}`       | x, y center of the rendered gcode model |\n| `max`            | `{x: number, y: number, z: number}` | maximum coordinates of the gcode model  |\n| `min`            | `{x: number, y: number, z: number}` | minimum coordinates of the gcode model  |\n| `filamentLength` |              `number`               |    length of the filament used in mm    |\n\n### CameraInitialPosition\n| Prop        |   Type   | Required |                                                                      Notes                                                                       |\n|-------------|:--------:|:--------:|:------------------------------------------------------------------------------------------------------------------------------------------------:|\n| `latitude`  | `number` |  `true`  | camera's position latitude, it should be a number between `- Math.PI / 2` and `Math.PI / 2`, if the number exceeds the limits it will be clamped |\n| `longitude` | `number` |  `true`  |    camera's position longitude, it should be a number between `- Math.PI` and `Math.PI`, if the number exceeds the limits it will be clamped     |\n| `distance`  | `number` |  `true`  |                                                  the distance between the object and the camera                                                  |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabotechs%2Freact-gcode-viewer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgabotechs%2Freact-gcode-viewer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabotechs%2Freact-gcode-viewer/lists"}