How do I read path data of a selected path

Just starting our developing a plugin for XD after developing a plugin for Sketch. I was able to get coordinates on the path and iterate through them. I was hoping someone could let me know if there’s a similar solution for XD? Or at least the pathData of a selected path?

var path = NSBezierPath.bezierPathWithCGPath(layers[1].pathInFrameWithTransforms().CGPath());
    var step = path.length()/15

for(var i=1;i<=count;i++) {

        // Current point
        var point = path.pointOnPathAtLength(step*i);

Hi @randyhuynh (welcome to the forums :wave:),

XD doesn’t offer a “big” interface for the paths. However, you can get and set the path of a selected layer (if it’s a path) by using the node.pathData attribute. This is a string which is just a “standard” SVG path string, meaning you can easily parse, manipulate or set it (there are also many JS libraries for dealing with JS paths out there, so I’m sure you’ll be able to find what you’re looking for).

For more information regarding pathData, please refer to and

I hope this answers your question,


Thanks! Got it to where I wanted it.

1 Like