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

Activate Dash and set values on a stroke via script

Community Beginner ,
Oct 11, 2019 Oct 11, 2019

Hi there,

I wonder how to access the dash options of a stroke via script.

I could create a stroke line and set values like width and color but I have no idea how to activate the dash.

Is access via script not possible?

 

Thanks!

Der Hirk

1.3K
Translate
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
LEGEND ,
Oct 12, 2019 Oct 12, 2019

Property groups. If a property isn't persistently and explicitly exposed or is contextual, it may show up by iterating through its group and finding its index.

 

Mylenium

Translate
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 Beginner ,
Oct 15, 2019 Oct 15, 2019

Ähh..I would like to add the porperty "ADBE Vector Stroke Dashes" to the property "Content" or "ADBE Vector Shape - Rect" or "ADBE Vector Grafic - Stroke" or I dont know where to add it.

I also tried to use "setValue" for "property "ADBE Vector Stroke Dashes" or simply "Dashes" and of course the whole hose of properties but nothing works.

Is "ADBE Vector Stroke Dashes" a member of the "Contents" property or is this subordinate to "Stroke"?  it does not seem to belong anywhere.

 

I have no idea how to iterate through a list of names(strings) or how to iterate through an Array with unknown dimensions and lenght.

 

 

thanks anyway

Translate
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 15, 2019 Oct 15, 2019

This snippet should give you tools you need to add a dash:

 

var myComp = app.project.activeItem;
var myLineLayer = myComp.layers.addShape();
var myShapeLayerContents = myLineLayer.property("ADBE Root Vectors Group");
var myShapeGroup = myShapeLayerContents.addProperty("ADBE Vector Group");
var myShapeContents = myShapeGroup.property("ADBE Vectors Group");
var myPathGroup = myShapeContents.addProperty("ADBE Vector Shape - Group");
var myPath = myPathGroup.property("ADBE Vector Shape");
var myShape = myPath.value;
myShape.vertices = [[0,0], [200,200]];
myShape.inTangents = [];
myShape.outTangents = [];
myShape.closed = false;
myPath.setValue(myShape);
var myStroke = myShapeContents.addProperty("ADBE Vector Graphic - Stroke"); // invalidates path
var myDash = myStroke.property("ADBE Vector Stroke Dashes").addProperty("ADBE Vector Stroke Dash 1");
myDash.setValue(25);

 

 

Dan

Translate
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 Beginner ,
Oct 17, 2019 Oct 17, 2019
LATEST
Many many thanks. I would never have come to ...Dash 1"). That was what I missed. Now everything works great. Thank you Dan!
Translate
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