0
$\begingroup$

I am a newcomer to Blender.

Briefly, I want to generate Points (x,y,z) model from a 3D model using Blender. And use these points to do numerical simulation. These points should be not only on the surface of the model.

I want to divide a 3D model into many small cubes at first, and then place some points inside each cube. Export these points' locations.

I've tried exporting my object as a .ply and chose the "ASCII" format instead of binary. But I find it only exports a few points. I want to control the number and location of points like points cloud.

If there were good solutions, please help me. Thanks.

$\endgroup$
9
  • 1
    $\begingroup$ I would try exporting your object as a .ply and choose "ASCII" format instead of binary. You can open the .ply with a text editor and the data will be written as plain text. $\endgroup$
    – Gorgious
    Commented Dec 6, 2022 at 15:18
  • $\begingroup$ Thanks. I find it only export few points. I want to control the number and location of points like points cloud. $\endgroup$
    – gd l
    Commented Dec 7, 2022 at 8:18
  • $\begingroup$ You'll have to be a little more specific about your workflow here because there is litterally an infinite number of ways to distribute points on a mesh surface :) $\endgroup$
    – Gorgious
    Commented Dec 7, 2022 at 8:28
  • $\begingroup$ What I want is to divide a 3d model into many small cubes at first, and then place some points inside of each cube. Export these points' location. $\endgroup$
    – gd l
    Commented Dec 7, 2022 at 8:49
  • $\begingroup$ Hello and welcome! Please give as many details as you can and add them to your question => Edit because the comments here can be removed, hidden, and change their order when they get upvotes. $\endgroup$
    – Blunder
    Commented Dec 7, 2022 at 9:32

1 Answer 1

0
$\begingroup$

I'm not sure if this is exactly what you want but let's give it a try.

The latest Blender version 3.4 that got released today has a new Geometry Node called Distribute Points in Volume. With it, you can scatter points inside a mesh.

Add a Geometry Nodes modifier to your mesh and wire the following nodes. Adjust their values according to your needs (Random/Grid, Density, Voxel Amount, etc).

screenshot

When you apply the modifier, you will have these scattered vertices in 3D space. (To apply it, hover the mouse over the modifier and press Ctrl+A or use the dropdown menu right next to its name. The menu entry Object > Convert To > Mesh also works.)

Point Clouds are still under development and access via Python script is limited. But since we can convert them to vertices they can be exported. Unfortunately, the *.ply ASCII exporter doesn't work when there are no faces. So here is a little script that does the export. Just adjust the file path, select the object with the point cloud vertices, and run it.

import bpy

obj = bpy.context.active_object

f = open("c:/tmp/point_cloud_data.csv", "w")  
for v in obj.data.vertices:
    f.write(f"{v.co.x}, {v.co.y}, {v.co.z}\n") 
f.close()
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .