Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

PathItem creation

Community Beginner ,
Sep 29, 2023 Sep 29, 2023

I'm trying to create a function that checks all the elements of a pathitem and reproduces it, but I'm not able to create the last edge that closes it, be it a straight line or a curve, below I leave an image of the result, could anyone give me some tip?Image.png

 

function RecreateDieCut () {
   var doc = app.activeDocument;

   var pathItemOriginal = doc.pathItems.getByName("path")
 
   var doc = app.documents.add();

   var novoPathItem = doc.pathItems.add();

   for (var i = 0; i < pathItemOriginal.pathPoints.length; i++) {
      var pathPointOriginal = pathItemOriginal.pathPoints[i];
      var pathPointNovo = novoPathItem.pathPoints.add();
     
      pathPointNovo.anchor = pathPointOriginal.anchor;
      pathPointNovo.leftDirection = pathPointOriginal.leftDirection;
      pathPointNovo.rightDirection = pathPointOriginal.rightDirection;
      pathPointNovo.pointType = pathPointOriginal.pointType;
   }
 
}

RecreateDieCut();
TOPICS
How-to , Scripting
291
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 29, 2023 Sep 29, 2023

if the original path is closed add this after your loop

 

novoPathItem.closed = true;

Translate
Adobe
Community Expert ,
Sep 29, 2023 Sep 29, 2023
LATEST

if the original path is closed add this after your loop

 

novoPathItem.closed = true;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines