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

[JS] [Action] Split or break a dashed line into separate (real) lines by script

Community Expert ,
Dec 23, 2021 Dec 23, 2021

Copy link to clipboard

Copied

Illustrator does not offer a direct way to convert dashed lines (e.g. for cutting plotters or CNC engraving).

 

Please do not reply to suggest the way to set the outline thickness to a very small value e.g. 0.0001pt. This way still creates filled rectangles and not real lines and is therefore unsuitable.

 

I also know some existing scripts that try to redraw the dash line. Unfortunately, these scripts are not an option either, because the results sometimes differ from the originals.

 

For several years I have used the manual way to break up a dashed line into single (real) lines:
- select the dashed line
- (optionally) create a duplicate and turn off the visibility of the original
- draw a horizontal straight line (helper object)
- remove the dash line attribute from the straight line (helper object)
- create an artbrush from this line (option: Artbrush, no further options, usually just confirm twice)
- delete the line (helper object)
- assign the newly created brush to the original dashed line (or its duplicate)
- use the menu command Object --> Expand Appearance
- ungroup two times
- group the selection and name the group as desired
- delete the artbrush

 

Since this process is rare, but needs to be done over and over again, I wanted to create a script.

Unfortunately there is a problem. Adobe Extendscript cannot be used to create or delete a brush. But it is possible to create a brush with an action. This action can be included in a script. But this way always needs additional confirmations by the user:

- select the option: Artbrush
- confirmation of the selection with [OK]
- confirming the options dialog with [OK] (usually without further settings)

 

 

Question: Does anyone know a way to create an art brush via script or action without additional user interaction (and delete it afterwards)?

 

-------------------------------------------------------------------------------------------

For those interested, here is an example action to create a brush in text form:

 

/version 3
/name [ 16
	63726561746544756d6d794272757368
]
/isOpen 1
/actionCount 1
/action-1 {
	/name [ 16
		63726561746544756d6d794272757368
	]
	/keyIndex 0
	/colorIndex 0
	/isOpen 1
	/eventCount 1
	/event-1 {
		/useRulersIn1stQuadrant 0
		/internalName (ai_plugin_brush)
		/localizedName [ 6
			50696e73656c
		]
		/isOpen 1
		/isOn 1
		/hasDialog 0
		/parameterCount 1
		/parameter-1 {
			/key 1835363957
			/showInPalette -1
			/type (enumerated)
			/name [ 12
				4e657565722050696e73656c
			]
			/value 1
		}
	}
}

 

Many thanks in advance.

 

TOPICS
Draw and design , Scripting

Views

3.6K

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
Community Expert ,
Feb 01, 2022 Feb 01, 2022

Copy link to clipboard

Copied

Well, then I may consider to irritate you with some more comments, so you will eventually write a perfect script and provide it for free, just to have some peace and quiet. 🙂

 

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 ,
Feb 07, 2022 Feb 07, 2022

Copy link to clipboard

Copied

Some minor improvements to minimise the number of anchor points:

 

Dash Nipper 5

 

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 ,
May 11, 2022 May 11, 2022

Copy link to clipboard

Copied

LATEST

Today I had some ideas to improve the Dash Nipper actions.

 

Of course, at the moment I will behave with discretion until Pixxxelschubser evaluates all the different approaches that he got in the past. As announced some times ago.

 

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