Skip to main content
January 12, 2010
Answered

Sechs-Ecken-Objekt mit InDesign CS3-Script / JavaScript ???

  • January 12, 2010
  • 2 replies
  • 1490 views

Hallo.

Können Sie mir evtl.  helfen? Siehe Bild im Anhang.

Wie kann ich dieses Sechs-Ecken-Objekt (Kontur 1 Pkt nach innen) mit Indesign-Script erstellen ? (InDesign CS3-Script / JavaScript)

myPolySCHATTEN = myDocument.pages.item(0).polygons.add();   ???

oder mit

myPath = myDocument.paths.item(0).add();                                  ???

Oder... ????

Freundliche Grüße,
AndreasRoe aus Germany

This topic has been closed for replies.
Correct answer Roy McCoy

AndreasRoe aus Germany

You don't say.

Vriendelijke groet,

RoyMcCoy uit Nederland

2 replies

January 12, 2010

Hey RoyMcCoy

see attachment...

Freundliche Grüße

Andreas

Jongware
Community Expert
Community Expert
January 12, 2010

Piece of cake.

You can either create a default Rectangle or Polygon, and add and move the points around, or -- my preferred way -- add a GraphicLine and add the other points to that path, until you are nearly done. Then set the path type to "Closed", and you are really done.

For starters, let's create a regular rectangle the hard way:

var hoehe = 10;
var breite = 20;

newrect = app.activeDocument.graphicLines.add ();
newrect.paths[0].pathPoints[0].anchor = [0,0];
newrect.paths[0].pathPoints[1].anchor = [0, hoehe];
newrect.paths[0].pathPoints.add({anchor:[breite,hoehe]});
newrect.paths[0].pathPoints.add({anchor:[breite,0]});
newrect.paths[0].pathType = PathType.CLOSED_PATH;

Run this and experiment with breite / höhe.

If you look at your drawing, you can see you need an inset value for the chopped off corners. You can also see where to add the new points, when you start counting at top left. That results in this -- notice how breite / höhe are adjusted one by one:

var hoehe = 50;
var breite = 100;
var inset = 4;

newrect = app.activeDocument.graphicLines.add ();
newrect.paths[0].pathPoints[0].anchor = [0,0];
newrect.paths[0].pathPoints[1].anchor = [0, hoehe - inset];

newrect.paths[0].pathPoints.add({anchor:[inset,hoehe]});
newrect.paths[0].pathPoints.add({anchor:[breite,hoehe]});

newrect.paths[0].pathPoints.add({anchor:[breite,inset]});
newrect.paths[0].pathPoints.add({anchor:[breite-inset,0]});

newrect.paths[0].pathType = PathType.CLOSED_PATH;

January 14, 2010

Hello,

thank you very much.

Regards,

Andreas

Roy McCoyCorrect answer
Inspiring
January 12, 2010

AndreasRoe aus Germany

You don't say.

Vriendelijke groet,

RoyMcCoy uit Nederland

January 12, 2010

Hey RoyMcCoy

see attachment...

Freundliche Grüße

Andreas