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

Select subpath

Explorer ,
Aug 11, 2019 Aug 11, 2019

Copy link to clipboard

Copied

Is it possible to select a subpath in a shape via script?

The goal is to select the star, then rotate it and subtract it from the other shape.

The problem is that I have not found a way to select the star

Photoshop_JO1CKaRx2p.png

Kind Regards

Joe

TOPICS
Actions and scripting

Views

2.4K

Translate

Translate

Report

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

People's Champ , Aug 11, 2019 Aug 11, 2019

SOLUTION!

app.preferences.rulerUnits = Units.POINTS;

Votes

Translate

Translate
Adobe
People's Champ ,
Jan 26, 2024 Jan 26, 2024

Copy link to clipboard

Copied

quote

I don't really understand all the code;I 'm just guessing.

The code runs reliably for point with integers coords, so afterall we are not so far away ?

I thought the problem could come from the IEEE754 function ( which is a totaly brand new universe for me ).

Can you confirm the problem doesn't come from this function ?

By @Panchromatic

 

For example, when using Points units in a ruler, the coordinates of pixels are still fractional, despite being integer in pixels. This function (IEEE75) is for writing numbers in float mode (32 bits) as they are stored in memory in machine code. The coordinates of path points are stored (I think so) in double mode (64 bits). Perhaps due to the difference in accuracy, the operation does not work accurately for many points and selection does not occur. I chose this operation because it contains the minimum amount of data. I calculated the click coordinates empirically and the fact that they are stored in float mode. There still remains some unknown data, the meaning of which I have not yet discovered and how it affects execution. Even if you fully understand how everything works there, it will not work reliably.

 

Example. I only have Photoshop CS6 for now. You can check it on your version as well. Create an Action where you record a click on your point, which is not highlighted by the script or any other point on the path. Unhighlight the path and run the Action. Very often the action will not work, i.e. will not select the point/path. It also depends on the zoom of the document. And since the Action works unreliably, it is stupid to try to reproduce it in a script, even knowing all the nuances of the data structure.

 

If you record a small square selection around a point in the Action using the PathSelection tool instead of point clicking, it will work. But at the same time, the amount of data will be gigantic. It's impossible to figure it out on your own. Moreover, execution will be very slow.

 

So forget about it. )

 

Votes

Translate

Translate

Report

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
Explorer ,
Jan 30, 2024 Jan 30, 2024

Copy link to clipboard

Copied

I have made some discovery about action tool recording. In fact, its the lack of precision of the click that can make the action to not works reliably.

If you want it to be successfull almost all the times, just do it this way :

- use a magnifier of your choice

- eventually, modify your mouse cursor to a + crosshair (Sorry, that's a bad idea, the crosshair can't show; I hadn't tried before posting the message)

- record you click action by clicking right in the middle of the targeted point.

This way, the recorded action should works without any flaw, though it will still depend on doc zoom level used at the time of recording.

Votes

Translate

Translate

Report

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
Explorer ,
Jan 31, 2024 Jan 31, 2024

Copy link to clipboard

Copied

Sorry for my lack of understanding.

Could you clarify the meaning of 

"This function (IEEE75) is for writing numbers in float mode (32 bits) as they are stored in memory in machine code. The coordinates of path points are stored (I think so) in double mode (64 bits)."

Does it mean that the function itself or its parameters have to be modified in order to make the script to work

or

does it mean that for some points coordinates the conversion to binary file format ( ? ) will never be match the expected data ?

 

Votes

Translate

Translate

Report

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
People's Champ ,
Feb 01, 2024 Feb 01, 2024

Copy link to clipboard

Copied

LATEST
quote

Sorry for my lack of understanding.

Could you clarify the meaning of 

"This function (IEEE75) is for writing numbers in float mode (32 bits) as they are stored in memory in machine code. The coordinates of path points are stored (I think so) in double mode (64 bits)."

Does it mean that the function itself or its parameters have to be modified in order to make the script to work

or

does it mean that for some points coordinates the conversion to binary file format ( ? ) will never be match the expected data ?

 


By @Panchromatic

 

https://en.wikipedia.org/wiki/IEEE_754

Votes

Translate

Translate

Report

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
People's Champ ,
Aug 11, 2019 Aug 11, 2019

Copy link to clipboard

Copied

It is also possible to write a complex script that will create a new path only from your specific subpath, perform the necessary actions with it. Then he will create a new path from the old one, where he will replace the necessary subpath with a new one and replace the whole old path with this one.

P.S. Type "select subpath" in the search bar

Votes

Translate

Translate

Report

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
Advocate ,
Aug 11, 2019 Aug 11, 2019

Copy link to clipboard

Copied

Can't confirm that it doesn't work in CC 2019.

For me it works in CC 2019 as expected.

Votes

Translate

Translate

Report

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
LEGEND ,
Aug 04, 2021 Aug 04, 2021

Copy link to clipboard

Copied

Due to forum transition from Jive to current platform I wanted to edit your post to correct the code.

 

Unfortunately the change I assume should be done, so:

 

var p = pth.subPathItems[x].pathPoints[pth.subPathItems[x].pathPoints.length-1];

 

 

may not be the only one to find as the Photoshop freezes after:

 

executeAction(stringIDToTypeID('toolRecording'), d, DialogModes.NO);

 

 

I tried a script in 22.4.3 release, so maybe that's a cause. Can you please see how that works for you?

 

I'm attaching one of files I ran script on.

Votes

Translate

Translate

Report

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