Skip to main content
Inspiring
Sep 6, 2016 6:39 AM UTC
Answered

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

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. 

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

So Please assist me.

Regards

Kundan

This topic is closed to new replies. Start a new post to keep the conversation going.
Ten A
Ten ACorrect answer
Community Expert
Oct 18, 2016 4:19 AM UTC

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

So Please assist me

Thanks in Advance .

Kundan


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.

21 replies

Ten A
Community Expert
Community Expert
Oct 18, 2016 5:33 AM UTC

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

Translate
Inspiring
Oct 18, 2016 6:01 AM UTC

Thanks for reply

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

Please assist me.

Thanks in Advance.

Kundan

Translate
Inspiring
Oct 19, 2016 5:32 AM UTC

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

Translate
Loic.Aigon
Legend
Sep 6, 2016 9:22 AM UTC
Inspiring
Sep 6, 2016 9:32 AM UTC

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

Translate
Ten A
Community Expert
Ten ACommunity ExpertCorrect answer
Community Expert
Oct 18, 2016 4:19 AM UTC

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

So Please assist me

Thanks in Advance .

Kundan


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.

Translate