[vtkusers] Set up vtk.js
Sebastien Jourdain
sebastien.jourdain at kitware.com
Wed Feb 21 10:43:42 EST 2018
I think you have several configuration mistakes. Please go through the
documentation and make sure you follow all the details.
Here is all the issue I've noticed:
1) the directory that should be listed is the ./dist not the root. (look at
your package.json on the line script > start > "webpack-dev-server
--content-base ./dist", )
2) MyWebApp.js should be in ./dist not in root (webpack config const
outputPath = path.join(__dirname, './dist'); )
3) The html should point to that MyWebApp.js file (like described in the
doc) not to 'src/index.js'
4) The html should be in ./dist so there is no way from that directory it
could reach MyWebApp.js as it is not in the same directory
On Wed, Feb 21, 2018 at 8:01 AM, YONE MORENO JIMÉNEZ <
yone.moreno101 at alu.ulpgc.es> wrote:
> *Sebastien I have followed the guide and the previous console error has
> gone ;=)*
>
>
> However after starting the webpack dev server I only see the directories
> structure, is not supposed to execute an application?
>
>
>
>
>
>
>
>
> It should be like the example: https://kitware.github.io/vtk-
> js/examples/ConeSource.html
>
>
> The architecture:
>
>
>
> I saw that in index.html the script being included was called MyWebApp in
> index.html:
>
>
>
> And I also tried to change it to index.js
>
>
> <!DOCTYPE html>
> <html>
> <head>
> <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
> <meta name="viewport" content="width=device-width, initial-scale=1">
> </head>
> <body>
> <script type="text/javascript" src="src/index.js"></script>
> </body>
> </html>
>
>
> However it also displays the list:
>
>
>
>
> Is it the correct output? I ask because I thought it was an unexpected
> behaviour.
>
>
> *Thank you for your help and time! * *😉*
> ------------------------------
> *De:* Sebastien Jourdain <sebastien.jourdain at kitware.com>
> *Enviado:* miércoles, 21 de febrero de 2018 14:16:01
> *Para:* YONE MORENO JIMÉNEZ
> *Cc:* vtkusers at vtk.org; Matt McCormick
> *Asunto:* Re: [vtkusers] Set up vtk.js
>
> Did you follow that guide? https://kitware.github.
> io/vtk-js/docs/intro_vtk_as_es6_dependency.html
>
> I think the file vtk.js/Utilities/config/dependency.js is missing the
> rule for the workers which was added yesterday night.
>
> You can see the missing rule here: https://github.com/
> Kitware/vtk-js/blob/master/Utilities/config/rules-vtk.js#L40-L45
>
> I'll fix it later today.
>
> Thanks,
>
> Seb
>
> On Wed, Feb 21, 2018 at 6:56 AM, YONE MORENO JIMÉNEZ <
> yone.moreno101 at alu.ulpgc.es> wrote:
>
> *Hello I would like some help or link to resources, because I have
> followed the introduction guide: *https://kitware.github.io/vtk-
> js/docs/develop_requirement.html to install vtk, node and git.
>
>
> I have been trying to integrate into a React aplication, and it outputs:
>
>
> Failed to compile
>
> ./node_modules/vtk.js/Sources/Rendering/OpenGL/Texture/index.js
> 1126:25-47 "export 'default' (imported as 'ComputeGradientsWorker') was not found in './ComputeGradients.worker'
>
>
> I just have used the code in: https://kitware.github.io/vtk-
> js/examples/PolyDataReader.html
>
>
> In addition if I go to the previous file and deep into
> ./ComputedGradients.worker, I navigate well to ComputeGradients.worker.js.
>
>
>
> Do I need other requirement to execute the aplication? I am using a node
> server.
>
>
> In addition I have written the code as React code:
>
>
> import React from 'react';
>
>
> import vtkActor from 'vtk.js/Sources/Rendering/Core/Actor';
> import vtkFullScreenRenderWindow from 'vtk.js/Sources/Rendering/Misc/FullScreenRenderWindow/index';
> import vtkMapper from 'vtk.js/Sources/Rendering/Core/Mapper';
> import vtkPolyDataReader from 'vtk.js/Sources/IO/Legacy/PolyDataReader';
>
> class LoadVTK extends React.Component() {
> render() {
> const fullScreenRenderer = vtkFullScreenRenderWindow.newInstance();
> const renderer = fullScreenRenderer.getRenderer();
> const renderWindow = fullScreenRenderer.getRenderWindow();
>
> const resetCamera = renderer.resetCamera;
> const render = renderWindow.render;
>
> const reader = vtkPolyDataReader.newInstance();
> reader.setUrl(`C:\Users\YonePC\WebstormProjects\prototipo\src\components\animals\cabezasegmentado02.vtk`).then(() => {
> const polydata = reader.getOutputData(0);
> const mapper = vtkMapper.newInstance();
> const actor = vtkActor.newInstance();
>
> actor.setMapper(mapper);
> mapper.setInputData(polydata);
>
> renderer.addActor(actor);
>
> resetCamera();
> render();
>
> });
>
> return (
> <div></div>
> );
>
> }
> }
>
> export default LoadVTK;
>
>
> And I have used it from the main page as:
>
> <LoadVTK/>
>
>
> *Could you help me please?*
>
> Antes de imprimir este correo electrónico, piense bien si es necesario
> hacerlo: el medio ambiente es una cuestión de todos.
>
> Please consider the environment before printing this email.
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensou
> rce/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://vtk.org/mailman/listinfo/vtkusers
>
>
>
> Antes de imprimir este correo electrónico, piense bien si es necesario
> hacerlo: el medio ambiente es una cuestión de todos.
>
> Please consider the environment before printing this email.
>
> Antes de imprimir este correo electrónico, piense bien si es necesario
> hacerlo: el medio ambiente es una cuestión de todos.
>
> Please consider the environment before printing this email.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180221/cb57aa6d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 26757 bytes
Desc: not available
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180221/cb57aa6d/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 26319 bytes
Desc: not available
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180221/cb57aa6d/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 12075 bytes
Desc: not available
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180221/cb57aa6d/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 9291 bytes
Desc: not available
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180221/cb57aa6d/attachment-0003.png>
More information about the vtkusers
mailing list