Skip to main content
This topic has been closed for replies.

10 replies

pixxxelschubser
Adobe Expert
November 23, 2020

Hi @femkeblanco and @Tom Winkelmann 

A side note:
You both use the wrong path points for calculation.

In this case:

instead of:

var x1 = points[4].anchor[0], x2 = points[5].anchor[0];
var y1 = points[4].anchor[1], y2 = points[5].anchor[1];

use:

var x1 = points[3].anchor[0], x2 = points[4].anchor[0];
var y1 = points[3].anchor[1], y2 = points[4].anchor[1];

 

But this will only help in this special case. Try not to rotate or mirror the rounded rectangle!

 

As I wrote at the beginning of this thread: A lot more math is required.

First you need to identify the two path points in the upper left corner. Then use these path points for your calculation.

 

aviel222Author
Known Participant
November 23, 2020

Excellent! This is what I need !!!
Just please move left, (and bigger) similar to the attached drawing.

 

pixxxelschubser
Adobe Expert
November 22, 2020

Unfortunately not.
I'm just showing you how other scripters should go about it to get the value for the radii.

 

Don't forget: I previously posted the less complex script snippet for the dashed outline here in the thread. Have you tried it meanwhile?

 

 

And again:

@pixxxelschubser wrote: "…Hi @aviel222,

1)

What about your other threads? Are they resolved?

For example:

 

Script correction to measure width and height together"

aviel222Author
Known Participant
November 22, 2020

Yes, it works great !!!
Thanks.

aviel222Author
Known Participant
November 22, 2020

So maybe someone else will help me about the round corners?

pixxxelschubser
Adobe Expert
November 22, 2020

Ok. The long way is mostly possible:

  • duplicate you pathItem ( = helpers object)
  • expand helpers object
  • read the values of each pathPoint
  • calculate the radius of each corner
  • write the values of your radii into document
  • remove the helpers object
aviel222Author
Known Participant
November 22, 2020

pixxxelschubser

I did not understand anything.
I'm asking if you can write me a script
Thanks 

pixxxelschubser
Adobe Expert
November 22, 2020

I'm sorry to have to laugh.

 

This is the worst case scenario. We don't have access to the Appearance panel and assigned effects.

aviel222Author
Known Participant
November 22, 2020

Friends
There was a misunderstanding
I'm attaching a screenshot to what I need

pixxxelschubser
Adobe Expert
November 22, 2020

Experience shows that one can very rarely rely on such assumptions. Especially if someone asks without an exact detailed description: Can someone write a script for me.

femkeblanco
Brainiac
November 22, 2020

I agree with your point:  detailed descriptions are critical. 

pixxxelschubser
Adobe Expert
November 22, 2020

Hi @femkeblanco 

please identify the roundness and if so the radius of each corner.

 

femkeblanco
Brainiac
November 22, 2020

Hi @pixxxelschubser.  I take your point about roundness.  But since we seem to be talking about a "radius", I presume we are talking about a (all symmetric) circle with a (single) radius. 

pixxxelschubser
Adobe Expert
November 22, 2020

Hi @Tom Winkelmann,

I'm the same opinion.

-----------------------------------------------------------------

 

Hi @aviel222,

1)

What about your other threads? Are they resolved?

For example:

 

Script correction to measure width and height together 

-----------------------------------------------------------------

 

2)

@aviel222 wrote: "I asked to expand an existing script … Nor did you refer to the fact that I need to calculate the radius …."

We are users like you. And we want to help you!

"Don't bite the hand that feeds you."

 

I gave you a partial solution to the outline (no scripting) that doesn't take any time - once the graphic style has been created. We don't know anything about your project. I am so sorry this was not acceptable to you!

 

Here is a script snippet that does the same - it creates a dashed stroke for the selected path item:

// pathItem_dashed_Stroke.jsx
// select one pathItem before running this script snippet
// regards pixxxelschubser

var aDoc = app.activeDocument;
var aSel = aDoc.selection[0];
aSel.stroked = true;
// swatch with name "CMYK Magenta" should already exists in your document
aSel.strokeColor = aDoc.swatches.getByName("CMYK Magenta").color;
aSel.strokeDashes = [2.8346457];
aSel.strokeWidth = 2.8346457;

 

There is no error management and you should build it into the other script yourself.

-----------------------------------------------------------------

 

3)

I will not make any changes to the script without the permission of the author! Sorry.

In addition, "your" script shown is an outdated variant.

-----------------------------------------------------------------

 

4)

The calculation of rounding depends on so many factors in your documents and objects that it is impossible to even remotely predict how much time it will take. So I cannot help you on this point.

aviel222Author
Known Participant
November 22, 2020

Why is it so complicated to calculate the radius of the corners of the rectangle?
(diagonal of a rectangle)

I do not mind paying you for it
But depends on how many.

aviel222Author
Known Participant
November 22, 2020

"Round corners" 

femkeblanco
Brainiac
November 22, 2020

By "radius" of a rectangle, do you mean diagonal of a rectangle?  I'm not sure where the r. 3528 in your attached file comes from. 

Tom Winkelmann
Inspiring
November 22, 2020

He was referring to the corner radius. Only he just made a mistake in the decimal place > instead of "r. 3528" he mean "r 3.528"

pixxxelschubser
Adobe Expert
November 21, 2020

Do you really need a script for that? I don't think.

 

Save a graphic style and apply it to all objects.

 

If that works for you

have fun

😉

 

aviel222Author
Known Participant
November 21, 2020

I asked to expand an existing script that I have attached because I do this thing many times a day. Nor did you refer to the fact that I need to calculate the radius. I would be grateful for the extension of the attached code.

Monika Gause
Adobe Expert
November 22, 2020

I would just ask the person who wrote the original script.