0
$\begingroup$

The following code is a copy from Add a simple vertex via python:

import bpy

def point_cloud(ob_name, coords, edges=[], faces=[]):
    """Create point cloud object based on given coordinates and name.

    Keyword arguments:
    ob_name -- new object name
    coords -- float triplets eg: [(-1.0, 1.0, 0.0), (-1.0, -1.0, 0.0)]
    """

    # Create new mesh and a new object
    me = bpy.data.meshes.new(ob_name + "Mesh")
    ob = bpy.data.objects.new(ob_name, me)

    # Make a mesh from a list of vertices/edges/faces
    me.from_pydata(coords, edges, faces)

    # Display name and update the mesh
    ob.show_name = True
    me.update()
    return ob

# Create the object
pc = point_cloud(".", [(0.0, 0.0, 0.0),(0.1,0.1,0.1)])


# Link object to the active collection
bpy.context.collection.objects.link(pc)
$\endgroup$
4
  • 2
    $\begingroup$ pass edges=((0, 1)) to create an edge from vert 0 to vert 1 Could you please post a link to script source if you sill have it. $\endgroup$
    – batFINGER
    Commented Aug 20, 2021 at 14:59
  • $\begingroup$ My question: In Input textbox, the user will be putting a configuration which will look something like this . 2-(90),5-(0),4-(-90). This above configuration means : Create a Line of 2 units in 90 degrees, 5 units in 0 degrees direction, and lastly, 4 units in -90 degrees. As a submit button is pressed your script should create lines in z-plane as shown. The top view will look something like this i.imgur.com/0GETSLY.jpg $\endgroup$ Commented Aug 20, 2021 at 15:09
  • 1
    $\begingroup$ Coincidentally answered that yesterday $\endgroup$
    – batFINGER
    Commented Aug 20, 2021 at 15:12
  • $\begingroup$ There are many code which is the correct code of the question can you share the correct code? $\endgroup$ Commented Aug 20, 2021 at 15:19

0

You must log in to answer this question.

Browse other questions tagged .