<div><div dir="auto">I would give you instructions on how to follow along with me, but they are a bit complex.  Basically you need a most recent version of X3DJSONLD, you need to put the file in a searchable place see /files in app.js or put it in src/main/data and src/main/html/index.html select options. Select or search for the file from <a href="http://localhost:3000">http://localhost:3000</a> (start server with node app.js). That will throw some errors to the web console.   Select the loadScripts line error and set a breakpoint at eval(scripts.text);   Rerun the file (select another file, then select below file again). Then step into the eval.   Set a breakpoint in the initialize method following “ecmascript” step into the nodeUtil method and see that element is right and getFieldValue is not a function.</div></div><div dir="auto"><br></div><div dir="auto">I will try some of your ideas below.  getAttribute does return something.   I think it’s just that X3DOM has not recognized the node because it’s inside a non-processed script field.</div><div dir="auto"><br></div><div dir="auto">Not really sure though.</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">John</div><div><div class="gmail_quote"><div dir="ltr">On Sat, Aug 4, 2018 at 1:47 PM John Carlson <<a href="mailto:yottzumm@gmail.com">yottzumm@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div dir="auto">I belive in this case, it’s the node and not the field we are trying to get the point field value from.   The problem is that getFieldValue is not defined because I am pretty sure that the node wasn’t processed by X3DOM????</div></div><div dir="auto"><br></div><div dir="auto">To change X3DOM, we would probably need a script tag and a way to handle the script fields. I believe these particular nodes are USEd elsewhere, so they should be active as nodes.  Hmm.</div><div dir="auto"><br></div><div dir="auto">Probably requires more investigation on my part.</div><div dir="auto"><br></div><div dir="auto">In this case, the nodes are coordinate and normal nodes.</div><div><br><div class="gmail_quote"><div dir="ltr">On Sat, Aug 4, 2018 at 8:53 AM Andreas Plesch <<a href="mailto:andreasplesch@gmail.com" target="_blank">andreasplesch@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Sat, Aug 4, 2018 at 4:56 AM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<br>
><br>
> I have a problem with this file in X3DOM, because as far as I can tell, the SFNode fields (the node, not the field) do not have getFieldValue for point etc. as a function, for example (but one can double check me).  In other words, I don’t think this node is an X3DOM node.<br>
<br>
I think you are referring to X3DOM's dom element method getFieldValue<br>
and that it does not work for SFNode type fields. For example:<br>
<br>
shapeDomNode.getFieldValue('Appearance')<br>
<br>
does not return anything.<br>
<br>
I do not think this will be fixed soon.<br>
<br>
You can try this instead<br>
<br>
shapeDomNode._x3domNode._cf.appearance<br>
<br>
with something like<br>
<br>
dom._x3domNode._cf[field.toLowerCase]<br>
<br>
which gives you an x3domNode object.<br>
<br>
><br>
> Thus I cannot take a reasonable length in the script.  One would have to parse the string.<br>
><br>
><br>
> That’s as clear as I can get.  I think this might be because x3dom does not process scripts correctly. We would need a script tag handler, and a field handler inside that.<br>
><br>
><br>
><br>
> Can you help Andreas?  I’ve created a script tag before, but that code is lost. It might be in my GitHub repository somewhere, not sure.<br>
><br>
><br>
><br>
> We just need a script tag that has fields, but doesn’t execute its CDATA section.  I am pretty sure<br>
<br>
If you add a type='text/x3dscript' (or anything) attribute, the<br>
browser will not try to execute the script.<br>
<br>
><br>
> How is V4.0 handling this?<br>
><br>
><br>
><br>
> Alternatively, I can change my nodeUtil code to look at the type and do the right thing converting a string to the correct type.   Suggestions are welcome.<br>
><br>
><br>
><br>
> Thanks for the great example, Vince,<br>
><br>
><br>
><br>
> Should I adapt my code to deal with this failing in X3DOM, or should we change X3DOM?<br>
<br>
What needs to be changed in x3dom ? The getFieldValue method ?<br>
<br>
-Andreas<br>
><br>
><br>
><br>
> John<br>
><br>
><br>
><br>
> Sent from Mail for Windows 10<br>
><br>
><br>
><br>
> From: <a href="mailto:vmarchetti@kshell.com" target="_blank">vmarchetti@kshell.com</a><br>
> Sent: Wednesday, August 1, 2018 9:04 PM<br>
> To: John Carlson; X3D-Public<br>
> Subject: Re: [x3d-public] good example for ECMAScripting and Protos?<br>
><br>
><br>
><br>
> See<br>
><br>
> <a href="http://www.kshell.com/pages/pointcloudvisualization/SphereDirectedPointSet.x3d" rel="noreferrer" target="_blank">http://www.kshell.com/pages/pointcloudvisualization/SphereDirectedPointSet.x3d</a><br>
><br>
><br>
><br>
> It is a X3D file with with a Prototype + ecmascript definition of a point cloud, with a vector attached to each point of the cloud.<br>
><br>
> Example used is just points randomly distributed on sphere with directs pointed radially outward.<br>
><br>
><br>
><br>
> Potential uses would be to implement the scanning design pattern at <a href="http://x3dgraphics.com/examples/X3dForAdvancedModeling/Scanning/X3dMeshDesignPatternIndex.html" rel="noreferrer" target="_blank">http://x3dgraphics.com/examples/X3dForAdvancedModeling/Scanning/X3dMeshDesignPatternIndex.html</a> , or<br>
><br>
> visualizing fluid flow or  electromagnetic field<br>
><br>
><br>
><br>
> On Jul 31, 2018, at 10:30 PM, John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<br>
><br>
><br>
><br>
> Is there a good example of ECMAScripting in X3D that I can use to test my X3D JSON ECMAScript preprocessor?  Preferably with Protos<br>
><br>
><br>
><br>
><br>
><br>
> Thanks!<br>
><br>
><br>
><br>
> John<br>
><br>
><br>
><br>
> _______________________________________________<br>
> x3d-public mailing list<br>
> <a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a><br>
> <a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" rel="noreferrer" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a><br>
><br>
><br>
><br>
><br>
<br>
<br>
<br>
-- <br>
Andreas Plesch<br>
Waltham, MA 02453<br>
</blockquote></div></div>
</blockquote></div></div>