Layer.reconectNodesAtNode1_ node2_ offset_ Consultation on changing the coordinates of Node1 and Node2

select_nodes = ()
for path in Layer.paths:
	for node in path.nodes:
		if node.selected == True:
			print(node.x)
			select_nodes = select_nodes + (node,)
print(select_nodes)
Layer.reconectNodesAtNode1_node2_offset_(select_nodes[0], select_nodes[1], 10.0)
print(select_nodes)

As shown in the above code, execute Layer.reconnectNodesAtNode1_ node2_ offset_ Select after (select_nodes [0], select_nodes [1], 10.0)_ Nodes will change, but I want to use the coordinates before the change. But I can’t get my first select_ Nodes coordinates. Or can you tell me how the rules changed

I have tested the clockwise and counterclockwise paths, as well as the different positions of the selected points, and cannot summarize the rules of change.

When the offset is 0, there will be no judgment of this situation, but there will be two more points on the original path, which cannot meet my requirements

I have two suggestions: either keep select_nodes unchanged, either they know the rules of change

Just a small side note:

This line is very wasteful. write it like this:

select_nodes.append(node)

I don’t really understand what you are trying to do. Can you explain in more detail?

select_nodes = []

for path in Layer.paths:

for node in path.nodes:

if node.selected == True:

print(node.x)

select_nodes.append(node)

print(select_nodes)

#Layer.clearSelection()

Layer.reconectNodesAtNode1_node2_offset_(select_nodes[0], select_nodes[1], 10.0)

print(select_nodes)
select_nodes are different before and after two prints, and I need to know that after executing Layer.reconnectNodesAtNode1_ node2_ offset_ After (select_nodes [0], select_nodes [1], 10.0), still obtain the first select_ nodes

If you’re posting code, use triple back ticks ``` before and after your code please. This will format your code in a more legible way.

Then you need to store the values yourself. The nodes will be moved around, so the values will change.

What are you using that info for?

I used the first select_nodes a judgment on the value of nodes for subsequent path movement

You can edit your post, don’t delete them all the time.

thanks!!!

Do you have any good suggestions for my question

I originally intended to save the select_nodes before and after to txt separately, and then read the first one again, which would be very troublesome. So I want to ask for advice.

If you just need the coordinates of the nodes, you can store them with

node1_position = node1.positionen

before changing the nodes. Then you can read the x and y values of those positions later.

thanks very much ,that is great!!!