Hello, can I draw a line segment by giving it the starting and ending coordinates through a Python script
coordinates = [(10, 10), (100, 100)]
my_path = GSPath()
for coordinate in coordinates:
new_node = GSNode()
new_node.position = coordinate
my_path.nodes.append(new_node)
Layer.shapes.append(my_path)
Thanks very much!!!
You can save one line:
coordinates = [(10, 10), (100, 100)]
my_path = GSPath()
for coordinate in coordinates:
new_node = GSNode(coordinate)
my_path.nodes.append(new_node)
Layer.shapes.append(my_path)
Thanks very much!!!
I love line-saving pissing contests.
coordinates = [(10, 10), (100, 100)]
my_path = GSPath()
my_path.nodes = [GSNode(coordinate) for coordinate in coordinates]
Layer.shapes.append(my_path)
1 Like
Between three points?
Just add a coordinate to the nodes list:
coordinates = [(10, 10), (100, 100), (10, 40)]
my_path = GSPath()
my_path.nodes = [GSNode(coordinate) for coordinate in coordinates]
Layer.shapes.append(my_path)
Add path.closed = True
if you want the path to be closed.
Tanks very much!!!