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

Adjust dashes is not possible via Scripting (SVG export dashes problem)

New Here ,
Mar 07, 2018 Mar 07, 2018

Copy link to clipboard

Copied

Hello,

it is not possible to use this function in the Stroke menu in Illustrator 2015 via Scripting:

Dash.png

This is the reason, why I use this Javascript function:

s.h's page : Scripts for Adobe Illustrator CS

Now I have a Problem, when I export a drawing in SVG format.

I have today a discussion in the Illustrator forum:

Export SVG changed the dashed line

The end of the discussion was, that the SVG export works, when I use the internal Illustrator function.

Unfortunately the SVG export does not work with the Javascript function.

I use the Javascript function in Illustrator. And the drawing looks fine in Illustrator:

SVG1.jpg

But when I export the drawing in SVG Format, then center line is wrong:

SVG2.jpg

When I adjust the dashes with the internal Illustrator function, then the SVG export looks fine.

Note: The drawing is imported in Illustrator from DWG format.

What can I do?

Can I use the internal Illustrator function in the newest Version via Scripting?

Is there an update of the Javascript function?

Any other workaround possible?

Best regards

Harald

TOPICS
Scripting

Views

587

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
Adobe
People's Champ ,
Mar 08, 2018 Mar 08, 2018

Copy link to clipboard

Copied

Not sure it will be the perfect answer but you could outline the paths prior to svg exports.

//Outlining stroke (given it's previously selected)

app.executeMenuCommand("OffsetPath v22");

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 ,
Mar 08, 2018 Mar 08, 2018

Copy link to clipboard

Copied

Can you save a graphic style with your preferred stroke settings and then access the graphic style via script and apply it to a path(s)?

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 ,
Mar 08, 2018 Mar 08, 2018

Copy link to clipboard

Copied

You may as well play on SVG coordinatePrecision property. Raise it to max and see if there is any changes :

https://www.indesignjs.de/extendscriptAPI/illustrator-latest/#ExportOptionsSVG.html

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
New Here ,
Mar 08, 2018 Mar 08, 2018

Copy link to clipboard

Copied

  1. The coordinatePrecison=7 gives also wrong result.
  2. I have no experience with graphic styles for center lines.
  3. When I use Object->Path->Outline stroke before SVG export it works!
    But I am not sure, if there are other negative effects?

I have done a lot of tests now!

It looks like a scaling problem, because the SVG Export works, when I open my DWG file with scaling=5 instead scaling=1.

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 ,
Mar 08, 2018 Mar 08, 2018

Copy link to clipboard

Copied

Potential negative effects include

     not having as much freedom to edit the file after it's saved (or at least not edit it in the same way as you would it it was a live stroke).

     slightly increased file size due to a larger number of anchor points.

My recommendation is to duplicate the artwork, then hide the original, expand the duplicate, export your svg, then delete the duplicate and reveal the original. that way you're not being destructive with your original file, but you still get the export results you're looking for.

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 ,
Mar 08, 2018 Mar 08, 2018

Copy link to clipboard

Copied

is your script drawing the lines? or is it just exporting to svg?

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
New Here ,
Mar 08, 2018 Mar 08, 2018

Copy link to clipboard

Copied

The drawing is a DWG file. My Illustrator script did:

- Open DWG file

- Align the center lines with the Javascript function I mentioned above

  Because I cannot use the internal Illlustrator function in the Stroke menu

- Export to SVG

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 ,
Mar 08, 2018 Mar 08, 2018

Copy link to clipboard

Copied

Align Dashes remembers your last setting. So if you could redraw the center lines, they will inherit the setting.

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
New Here ,
Mar 10, 2018 Mar 10, 2018

Copy link to clipboard

Copied

LATEST

I have done several tests. The center lines are correct when I use the internal Illustrator stroke buttons:

Dash.png

When I did this steps manually:

- Open DWG file

- Use the stroke menu to align the dashes (not Javascript function)

- Export to SVG

Then the center lines in the SVG file are correct.

It seems, the Javascript function is not working correctly.

What can I do?

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