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

script file(.js) for simplify the path points..............

Engaged ,
Sep 05, 2016 Sep 05, 2016

Copy link to clipboard

Copied

I am using Illustrator CC 2015 version ,When I am loading any dxf or pdf file in Illustrator ,it is

showing too many points.

For removing these unused points, I am using the menu Object --> Path --> Simplify options.

After changing some values of simplify path option , It removes the unused points.

These points are given below it's showing the before apply the Simplify and after apply the simplify option. 

simplify.png

I want to the Script file (java script ) OR  code for this Simplfy options.

So Please assist me.

Regards

Kundan

TOPICS
Scripting

Views

2.9K

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

Community Expert , Oct 17, 2016 Oct 17, 2016

You can edit Parameter-2 value 0.0 to 180.0 like below

(function (){

  var actionCode = "/version 3 /name [ 4 73657431]"

  + "/isOpen 1 /actionCount 1"

  + "/action-1 {/name [ 7 616374696f6e31]"

  + "/keyIndex 0 /colorIndex 0 /isOpen 1"

  + "/eventCount 1"

  + "/event-1 {/useRulersIn1stQuadrant 0 /internalName (ai_plugin_simplify)"

  + "/isOpen 0 /isOn 1 /hasDialog 1 /showDialog 0 /parameterCount 4"

  + "/parameter-1 {"

  + "/key 1919182693 /showInPalette 4294967295"

  + "/type (unit real) /value

...

Votes

Translate

Translate
Adobe
People's Champ ,
Sep 06, 2016 Sep 06, 2016

Copy link to clipboard

Copied

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
Engaged ,
Sep 06, 2016 Sep 06, 2016

Copy link to clipboard

Copied

Thanks for reply Loic.

I already try to applied as you suggest but it's not useful.

It changes the shape also, I have to constant my shape.

I need the script for  Simplify , It will work properly.

Regards

Kundan

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
Community Expert ,
Sep 06, 2016 Sep 06, 2016

Copy link to clipboard

Copied

In this case, You can use actions like below.

(function (){

  var actionCode = "/version 3 /name [ 4 73657431]"

  + "/isOpen 1 /actionCount 1"

  + "/action-1 {/name [ 7 616374696f6e31]"

  + "/keyIndex 0 /colorIndex 0 /isOpen 1"

  + "/eventCount 1"

  + "/event-1 {/useRulersIn1stQuadrant 0 /internalName (ai_plugin_simplify)"

  + "/isOpen 0 /isOn 1 /hasDialog 1 /showDialog 0 /parameterCount 4"

  + "/parameter-1 {"

  + "/key 1919182693 /showInPalette 4294967295"

  + "/type (unit real) /value 100.0 /unit 592474723}"

  + "/parameter-2 {"

  + "/key 1634561652 /showInPalette 4294967295 /type (unit real) /value 0.0 /unit 591490663}"

  + "/parameter-3 {"

  + "/key 1936553064 /showInPalette 4294967295 /type (boolean) /value 0}"

  + "/parameter-4 {"

  + "/key 1936552044 /showInPalette 4294967295 /type (boolean) /value 0}}}";

  var tmp = File(Folder.desktop + "/tmpSet1.aia"); 

  tmp.open('w'); 

  tmp.write(actionCode);

  tmp.close();

  app.loadAction(tmp);

  app.doScript("action1", "set1", false); 

  app.unloadAction("set1","");

  tmp.remove();

  }());

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 ,
Sep 06, 2016 Sep 06, 2016

Copy link to clipboard

Copied

Only thing I coudl find is :

app.executeMenuCommand('simplify menu item');

But it will open the dialog

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 ,
Sep 06, 2016 Sep 06, 2016

Copy link to clipboard

Copied

interesting but if applied on a simple oval with extra points it tends to actually add points.

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
Engaged ,
Sep 06, 2016 Sep 06, 2016

Copy link to clipboard

Copied

Thanks for reply Ten A and Loic .

As you suggest It may be useful and Simplify windows is opening in Illustrator

How I will set these Simplify value "Curve Precision " and "Angle Threshold "

value and how I will make "show original " clicked.

I have set all these value

simpligy1.png

so Please assist me

Regards

Kundan

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
Engaged ,
Sep 08, 2016 Sep 08, 2016

Copy link to clipboard

Copied

Hello I am still waiting,

How I will perform above action through script ?

Please assiat me.

Thanks in advance.

Kundan

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
Community Expert ,
Sep 08, 2016 Sep 08, 2016

Copy link to clipboard

Copied

Previouse one is a Javascript that make action set file and load it, run action and remove actionset automatically.

I was set to curve presition = 100 and angle threshold = 0.

Try 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
Engaged ,
Sep 09, 2016 Sep 09, 2016

Copy link to clipboard

Copied

Thanks Ten,

Now I am able to change the curve presition value using your terminology.

Thanks

Kundan

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
Engaged ,
Sep 09, 2016 Sep 09, 2016

Copy link to clipboard

Copied

Hello Ten,

This script is  properly working  with  CS6 and upper version (like Illustrator cc 2015 and 2015.3 )

but when I am using this script with Illustrator cs5, It gives the error message

"doAction is not a function".

so Please assist me.

Untitled11.png

Thanks in advance

Kundan

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
Community Expert ,
Sep 09, 2016 Sep 09, 2016

Copy link to clipboard

Copied

AFAIK loadAction method require up to CS6...

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
Engaged ,
Sep 09, 2016 Sep 09, 2016

Copy link to clipboard

Copied

Thanks for reply

So What I need to change in above script.

Thanks

Kundan

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
Community Expert ,
Sep 09, 2016 Sep 09, 2016

Copy link to clipboard

Copied

nothing you can do, running Actions with Javascript is not supported in CS5

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
Engaged ,
Oct 17, 2016 Oct 17, 2016

Copy link to clipboard

Copied

Hello Ten,

As you suggested as previous message ,it's working fine.

But when I applying Angle Threshold with 180 degree  it's not applying .

I am doing some changes in your code but it's not working, it's given below

aaaa.png

So Please assist me

Thanks in Advance .

Kundan

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
Community Expert ,
Oct 17, 2016 Oct 17, 2016

Copy link to clipboard

Copied

You can edit Parameter-2 value 0.0 to 180.0 like below

(function (){

  var actionCode = "/version 3 /name [ 4 73657431]"

  + "/isOpen 1 /actionCount 1"

  + "/action-1 {/name [ 7 616374696f6e31]"

  + "/keyIndex 0 /colorIndex 0 /isOpen 1"

  + "/eventCount 1"

  + "/event-1 {/useRulersIn1stQuadrant 0 /internalName (ai_plugin_simplify)"

  + "/isOpen 0 /isOn 1 /hasDialog 1 /showDialog 0 /parameterCount 4"

  + "/parameter-1 {"

  + "/key 1919182693 /showInPalette 4294967295"

  + "/type (unit real) /value 100.0 /unit 592474723}"

  + "/parameter-2 {"

  + "/key 1634561652 /showInPalette 4294967295 /type (unit real) /value 180.0 /unit 591490663}"

  + "/parameter-3 {"

  + "/key 1936553064 /showInPalette 4294967295 /type (boolean) /value 0}"

  + "/parameter-4 {"

  + "/key 1936552044 /showInPalette 4294967295 /type (boolean) /value 0}}}";

  var tmp = File(Folder.desktop + "/tmpSet1.aia");  

  tmp.open('w');  

  tmp.write(actionCode);

  tmp.close();

  app.loadAction(tmp);

  app.doScript("action1", "set1", false);  

  //app.unloadAction("set1","");

  tmp.remove();

  }());

Its work fine in my environment.

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
Engaged ,
Oct 17, 2016 Oct 17, 2016

Copy link to clipboard

Copied

Thanks for reply

But when I am applying this code it's showing one corner point as a curve points other points are ok.

When I am apply this value manually using Object -> Path -> Simplify , it comes fine.

cccc.png

Please assist me.

Thanks in Advance.

Kundan

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
Community Expert ,
Oct 17, 2016 Oct 17, 2016

Copy link to clipboard

Copied

To set showDialog value 0 to 1 in the 8th line and retry it. The dialog will come up and you can check parameters.

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
Engaged ,
Oct 17, 2016 Oct 17, 2016

Copy link to clipboard

Copied

Thanks for reply

It's comes with same value but that curve is still remain.

Please assist me.

Thanks in Advance.

Kundan

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
Engaged ,
Oct 18, 2016 Oct 18, 2016

Copy link to clipboard

Copied

Hello Ten,

I wish  to get the file type (like AI and PDF or DXF ) and  above code should be apply on the basis of

of file type . I wish to do all these through the js code.

Please assist me.

Thanks in Advance

Kundan

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
Community Expert ,
Oct 19, 2016 Oct 19, 2016

Copy link to clipboard

Copied

I was test previouse one and works fine in my environment.

Probably, your value not applied and use previouse value. Unfortunatly, I have no idea.

BTW, Have you ever made action with simlify command? If not, Try to make an action with actionset at your own and test it. If it works correctly, You can export action and open it in text editor. You'll see action strings.

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
Engaged ,
Oct 19, 2016 Oct 19, 2016

Copy link to clipboard

Copied

LATEST

Thanks for reply Ten.

Now It's working in my side also.

Ok I am trying to make a action.

Regards

Kundan

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