Distributing midpoints like objects?


#1

I am interested in the possibility of programmatically distributing midpoints of connectors like we do with objects. Basically what this post is about, but with a solution based on scripting rather than a grid (which doesn’t work in the generic case anyway).

The question is whether midpoints are selectable as objects to be distributed. I have an ancient version of OG (5.4.4), so I can only Copy as AppleScript, but this is more a question of object structure than of language.

These 4 connectors have only the default handles that are automatically generated when a connector is connected. But whether they’re here:

or here:

they Copy as AppleScript identically:

	make new line at end of graphics with properties {point list: {{175.9608, 481.73}, {293, 536.7249}}, line type: orthogonal, stroke color: {0.000000, 0.000000, 1.000000}, head type: "FilledArrow", head scale: 0.5}
	make new line at end of graphics with properties {point list: {{175.9608, 476.8676}, {293, 531.8624}}, line type: orthogonal, stroke color: {0.000000, 0.000000, 1.000000}, head type: "FilledArrow", head scale: 0.5}
	make new line at end of graphics with properties {point list: {{175.9608, 491.455}, {293, 546.4498}}, line type: orthogonal, stroke color: {0.000000, 0.000000, 1.000000}, head type: "FilledArrow", head scale: 0.5}
	make new line at end of graphics with properties {point list: {{175.9608, 486.5925}, {293, 541.5873}}, line type: orthogonal, stroke color: {0.000000, 0.000000, 1.000000}, head type: "FilledArrow", head scale: 0.5}

The location of the default handle doesn’t appear to get saved.

Is this true in the latest OG via Save As Javascript?

If I double-click to add Midpoints, like this:

then those get copied as discrete points:

	make new line at end of graphics with properties {point list: {{175.9608, 481.73}, {248, 503}, {293, 536.7249}}, line type: orthogonal, stroke color: {0.000000, 0.000000, 1.000000}, head type: "FilledArrow", head scale: 0.5}
	make new line at end of graphics with properties {point list: {{175.9608, 476.8676}, {261, 503}, {293, 531.8624}}, line type: orthogonal, stroke color: {0.000000, 0.000000, 1.000000}, head type: "FilledArrow", head scale: 0.5}
	make new line at end of graphics with properties {point list: {{175.9608, 491.455}, {225, 519}, {293, 546.4498}}, line type: orthogonal, stroke color: {0.000000, 0.000000, 1.000000}, head type: "FilledArrow", head scale: 0.5}
	make new line at end of graphics with properties {point list: {{175.9608, 486.5925}, {235, 514}, {293, 541.5873}}, line type: orthogonal, stroke color: {0.000000, 0.000000, 1.000000}, head type: "FilledArrow", head scale: 0.5}

It seems like that would be a fairly straightforward programming exercise to distribute evenly the X or Y positions of each non-terminal point.


#2

I am not responding to the scripting issues, or suggesting that you should not proceed with that.

I am clarifying the references to that post, particularly your question, and my answer. I added an entire section for Lines (probably after you read my answer yesterday, and posted this new topic). Look for the heading Answer B • Line

Yes, it is generic. I do not understand how a higher level standard (higher than the objects and lines) is not generic, or how it does not serve the “generic case”.

  • Certainly, the seconds it takes to draw a line is slower than a scripted production, as long as the lines do not have to be moved, which takes more seconds, and nullifies the value of the script.

  • Your third diagram Added Midpoints doesn’t look very good (scripted or not). The Lines are not evenly spaced. Only a Grid can accomplish that.

  • If you do use a script, it must have knowledge of the Grid, and perform its “Even spacing” on GridPoints, not on points relative to the StartOfLine.

Yes,

  • MidPoints are selectable, same as objects.

  • MidPoints are placeable on GridPoints and GridLines, same as Objects. MidPoints SnapToGrid

  • And if for some reason a MidPoint is off the Grid (sorry) you can correct it with AlignToGrid.

Please read my detailed answer.

Hah! That is what I use every day, day in and day out. It may be ancient, but it is far less problematic than OG 6 or 7.

Cheers


#3

Have things improved on this front with OG 7.12.1? I recently upgraded from 5.4, and I’m curious to see whether there is an programmatic way to distribute connecting lines without using a grid.

Yes, I know a grid the solution in some cases, but it is not the solution in my case.

I want to know if there is a way to distribute the handles and/or midpoints. I did a Copy as Javascript and I still don’t see that the default handle coordinates are getting copied.

Thanks!