Copy link to clipboard
Copied
Hello,
it is not possible to use this function in the Stroke menu in Illustrator 2015 via Scripting:
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:
But when I export the drawing in SVG Format, then center line is wrong:
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
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");
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)?
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
Copy link to clipboard
Copied
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.
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.
Copy link to clipboard
Copied
is your script drawing the lines? or is it just exporting to svg?
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
Copy link to clipboard
Copied
Align Dashes remembers your last setting. So if you could redraw the center lines, they will inherit the setting.
Copy link to clipboard
Copied
I have done several tests. The center lines are correct when I use the internal Illustrator stroke buttons:
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?