sketchucation logo sketchucation
    • Login
    1. Home
    2. eengin
    3. Posts
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download
    E
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Groups 1

    Posts

    Recent Best Controversial
    • Export SKP to Voxel File

      Dear All,

      I am a electronics engineer and I often use Matlab software. It is
      basically a software that enables you make computations with matrices.
      What I need is to export my 3D model into such a file that I can
      convert it into a Matlab 3D matrix to perform further analysis.

      To make things more clear I want to give an example. Say that you have
      an optical fiber in cylindrical shape which has is composed of a core
      region and a cladding. That is think of a thick pipe (the cladding)
      which is is filled by a cylinder of different material (the core).
      First I want to mesh the 3D model I draw in SketchUp in to small
      equivalent cubes. What I want from SketchUp is to give me an output
      file saying:

      The cube (0,0,0) is made of material_1 (or belongs to cladding)
      The cube (0,0,1) is made of material_1
      ...
      The cube (j,k,l) is made of material_n (or belongs to core)
      ...

      in some format.

      I would prefer this kind of format: For the fiber we should get:

      assuming material2 is air, material0 is cladding, material1 is the
      core:


      for z=0 plane:

      222222222222222222222
      222222000000000222222
      222200000000000002222
      222000001111100000222
      220000011111110000022
      220000011111110000022
      222000001111100000222
      222200000000000002222
      222222000000000222222
      222222222222222222222

      for z=1 plane:

      222222222222222222222
      222222000000000222222
      222200000000000002222
      222000001111100000222
      220000011111110000022
      220000011111110000022
      222000001111100000222
      222200000000000002222
      222222000000000222222
      222222222222222222222

      ....


      and so on.

      I think these kinds of files are called voxel files.

      Is there any such available script to convert a model to this format.?
      If not is there any one willing to write such a script? There are some
      available software for simulating such things but they really lack a
      3D modeling interface. So if such a thing is available I am sure many
      engineers will use this to load a 3D model with Matlab or other
      simulation software.

      I found a Python script for Blender doing the thing I want in:
      http://gamulabs.freepgs.com/blends/scripts/b2mat/b2mat_01a.zip

      This script outputs a text file,
      it has only two lines and the data is in the second line. First line
      tells the dimension. An example is "120x20x60". And the second line
      consists -1's and zeros separated by comma. Therefore there are a
      total of 1202060=144000 1's or 0's. You just have to reshape this
      data into a 120x20x60 matrix. I don't know whether the exact same
      thing is applicable in SketchUp.

      Regards

      posted in Developers' Forum
      E
      eengin
    • 1 / 1