Draw the line
Aug 16, 2021
Introduction
To understand why Turtlestack libraries can be so helpful let’s have a look at a trivial example of NXOpen code - we are going to draw a line.
Many engineers who come to NXOpen will start by ‘journal recording’ an action and then adapt the code they find there into something repeatable and useful. So let’s journal record the drawing of a line (you can try it yourself by clicking Menu > Tools > Journal > Record)
In fairness, these 140 lines consist of boilerplate, useful bits and undo points, and some nonsense. But if you are an NXOpen newbie good luck teasing apart which is which!
Contrast this with the Turtlestack equivalent
a = Vector(1.0, 2.0, 3.0)
b = Vector(4.0, 5.0, 6.0)
myLine = Line(a, b)
Hopefully, that seems simpler!
But all of this does beg an obvious question - why on earth is NXOpen so complex? Let’s have a look at the GUI for drawing a line:
To paraphrase Arthur C Clarke - lift the hood on the NXOpen builders and you will find ….
Options, options, and more options - all great - and part of what makes NX so powerful is having all of these at your disposal! BUT our contention is that 80% of users and developers take only 20% of the possible routes.
Turtlestack libraries wraps up the most used approaches and makes them way simpler to implement.
Paul Booth