Minimal Working X3d Example

Discussion in 'Tips and How-tos' started by rosen21, Sep 27, 2017.

Tags:
  1. rosen21
    rosen21 New Member
    I'm trying to reverse engineer the Shapeways X3D file upload requirements and I haven't been able to find a working example to start from. Can someone share the contents of a really simple X3D file which they know to work with Shapeways? For example, something simple like a cube would be great.

    Thanks!

    (Ideally someone can just post the contents of the X3D file as a reply to the forum, rather than an attachment.)
     
  2. mkroeker
    mkroeker Well-Known Member
    What exactly are you trying to achieve ? X3D is not shapeways' or a printer manufacturer's invention, it has been around for "virtual reality" applications a bit longer. The underlying VRML is about 20 years old, and unless you really love having XML on everything sticking with VRML2 is probably easier. Descriptions and tutorials for both dialects are not that hard to find, e.g. your cube scene is on http://edutechwiki.unige.ch/en/X3D_shape_and_geometry
     
  3. MitchellJetten
    MitchellJetten Shapeways Employee CS Team
  4. mkroeker
    mkroeker Well-Known Member
    The problem with that approach is that one needs to convert the x3db to human-readable x3d in order to learn anything from it. ("b" is binary and it is a proprietary encoding of the xml data, not just a compressed version of the plaintext data)
     
  5. MitchellJetten
    MitchellJetten Shapeways Employee CS Team
    AH, yeah that all sounds like rocket science to me :)

    Is this what you're looking for?
    upload_2017-9-27_15-57-6.png

    Code:
    <?xml version="1.0" encoding ="UTF-8"?>
    
    <X3D profile="Interchange" version="3.0">
      <head>
        <component name="Rendering" level="3"/>
        <meta name="generator" content="netfabb Professional"/>
        <meta name="version" content="2.0.0"/>
      </head>
      <Scene>
        <Shape>
          <IndexedFaceSet normalPerVertex="false" coordIndex="
            3 8 20 -1
            20 11 3 -1
            11 20 10 -1
            10 0 11 -1
            8 2 9 -1
            9 20 8 -1
            20 9 1 -1
            1 10 20 -1
            4 12 21 -1
            21 15 4 -1
            15 21 14 -1
            14 7 15 -1
            12 5 13 -1
            13 21 12 -1
            21 13 6 -1
            6 14 21 -1
            0 10 22 -1
            22 17 0 -1
            17 22 12 -1
            12 4 17 -1
            10 1 16 -1
            16 22 10 -1
            22 16 5 -1
            5 12 22 -1
            1 9 23 -1
            23 16 1 -1
            16 23 13 -1
            13 5 16 -1
            9 2 18 -1
            18 23 9 -1
            23 18 6 -1
            6 13 23 -1
            2 8 24 -1
            24 18 2 -1
            18 24 14 -1
            14 6 18 -1
            8 3 19 -1
            19 24 8 -1
            24 19 7 -1
            7 14 24 -1
            3 11 25 -1
            25 19 3 -1
            19 25 15 -1
            15 7 19 -1
            11 0 17 -1
            17 25 11 -1
            25 17 4 -1
            4 15 25 -1
            ">
            <Coordinate point="
              0.000000 0.000000 0.000000 0.100000 0.000000 0.000000 0.100000 0.100000 0.000000 0.000000 0.100000 0.000000 0.000000 0.000000 0.100000 0.100000 0.000000 0.100000 0.100000 0.100000 0.100000 0.000000 0.100000 0.100000 0.050000 0.100000 0.000000 0.100000 0.050000 0.000000 0.050000 0.000000 0.000000 0.000000 0.050000 0.000000 0.050000 0.000000 0.100000 0.100000 0.050000 0.100000 0.050000 0.100000 0.100000 0.000000 0.050000 0.100000 0.100000 0.000000 0.050000 0.000000 0.000000 0.050000 0.100000 0.100000 0.050000 0.000000 0.100000 0.050000 0.050000 0.050000 0.000000 0.050000 0.050000 0.100000 0.050000 0.000000 0.050000 0.100000 0.050000 0.050000 0.050000 0.100000 0.050000 0.000000 0.050000 0.050000 "/>
          </IndexedFaceSet>
        </Shape>
      </Scene>
    </X3D>
    
     
  6. rosen21
    rosen21 New Member
    Thanks so much for the example Mitchell! This is exactly what I was looking for. When I put it in an X3D file, It successfully uploads to Shapeways.

    A bit of context after the fact: I am building my own X3D files and I find that the some X3D viewers (namely the browser-based xhtml ones) will display the objects fine, but I get a mysterious error message when I try to upload to Shapeways. This is true even for what seem to be simple example X3D files from places like http://www.web3d.org/x3d/content/examples/Basic/. So, my goal is to incrementally add features to a known good example until I find the issue with my files that is causing the failure.

    Thanks!
     
  7. mkroeker
    mkroeker Well-Known Member
    VRML viewers will usually not complain about misoriented face normals or objects sharing a common edge, issues that can overwhelm shapeways' automatic correction software. I have found the combination of view3dscene and meshlab most useful for my work.
     
  8. brutzman
    brutzman New Member
  9. MrNibbles
    MrNibbles Well-Known Member
    I had wanted to compare several file formats just for the fun of it, or if I decided to create files from scratch or modify the contents of existing data (geometry or colors). Anyway I finally got around to it.

    I created a design in Tinkercad that would have as few triangles as possible and exported it in stl, x3d, wrl, and obj formats. You can't actually color a specific triangle in Tinkercad so the best I could figure out was a pyramid built up in two colors having 10 triangles total (six on top, 4 on the bottom square section). Each triangle is one solid color as opposed to vertex coloring with color gradients happening across the surfaces.

    pyramid 3d small.jpg
    https://www.tinkercad.com/things/20DfBpzaC2b-pyramid-3d-example

    The attached zip file contains the obj and accompanying mtl file containing color information. I made the design public in Tinkercad so you can also download the files from there if you wish or copy it to your account and play around with it.
     

    Attached Files:

    Last edited: Oct 6, 2017
  10. cadycarlsondesigns
    cadycarlsondesigns Well-Known Member
    Anyone know a program that opens x3d files? None of my "fancy" ones do
     
  11. MrNibbles
    MrNibbles Well-Known Member
    If it's a non-color design then you can open an x3d file in Netfabb and then export it to a different format such as stl. I have an old downloaded version of Netfabb Studio that was free but I think it was acquired by another company and you might need to use a newer version that may or may not be free with a trial period. (Maybe Netfabb also does color but I'm not sure about that.)

    The color example pyramid above can be opened using Meshlab, but I needed to change the color type from vertex to face in a Meshlab dialogue box. Then it could be exported to another color compatible format if it better suits your needs.
     
  12. cadycarlsondesigns
    cadycarlsondesigns Well-Known Member