0

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)

brockmann
  • 12,613
  • 4
  • 50
  • 93
  • 2
    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. – batFINGER Aug 20 '21 at 14:59
  • 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 https://i.imgur.com/0GETSLY.jpg

    – Fenil Mehta Aug 20 '21 at 15:09
  • 1
  • There are many code which is the correct code of the question can you share the correct code? – Fenil Mehta Aug 20 '21 at 15:19

0 Answers0