1
$\begingroup$

I am writing a Python script and in part of it I want to do an Add > Curve > Path operation, but instead of the default 5-vert straight path, I want one at the object origin (which I have pre-defined with coordinates orig_x orig_y orig_z), and then another at some other location (let's say coords end_x end_y end_z).

Instead of the default primitive NURBS path, I want the script to add my own, which is just 2 vertices.

Here's that line of my script as it is currently:

bpy.ops.curve.primitive_nurbs_path_add(radius=1, enter_editmode=False, align='CURSOR', location=(orig_x, orig_y, orig_z), scale=(1, 1, 1))

I can't figure out if I should start by deleting all the vertices, then re-adding two, OR if I should try to select just the second [1] and fourth [3] indices and Dissolve Vertices... I've tried both approaches without success. I'm doing something wrong when trying to target those verts.

Can someone please point me in the right direction?

$\endgroup$
7
  • $\begingroup$ Does this help ? blender.stackexchange.com/q/61266/86891 $\endgroup$ – Gorgious Oct 15 '20 at 9:09
  • $\begingroup$ @Gorgious Thanks for the clue. It helps a little, but also raises new questions about how that person removed the existing verts. I'm still studying it. $\endgroup$ – Mentalist Oct 15 '20 at 9:57
  • $\begingroup$ Well the idea is not to use the operator but rather instantiate an empty curve and add the relevant points rather than working backwards from a primitive curve added with an operator. I personnaly have trouble with both so I won't be of much more help but still, food for thought $\endgroup$ – Gorgious Oct 15 '20 at 10:34
  • $\begingroup$ Thanks, batFINGER! By following links from your link, I found this question that when I put the answers together, appears to be the sort of example I needed. $\endgroup$ – Mentalist Oct 15 '20 at 11:31
  • 1
    $\begingroup$ NP Often see don't use operators in comments, my rule of thumb in particular is avoid edit mode toggling and edit mode operators.. $\endgroup$ – batFINGER Oct 15 '20 at 11:49

Browse other questions tagged or ask your own question.