@mike yeah that is defiantly recreating the path, the path to shape part didn't work but I replaced that with something I already had written.
As you identified the major issues comes from the faulty paths with regard to the inner details not being created. With a little experimentation I've discovered the problem lies with paths created with csh shapes. If you have a shape drawn entirely with the pen tool and have all points set to exclude overlapping shapes you can recreate a carbon copy of the shape using your script.
I think I have enough now to forge together the script I was trying to create with all of the snippets from this post so thanks for all the input guys
@pfaffenbichler thats for the new script I'll take a look at it.
custom shape point data
-
pfaffenbichler
custom shape point data
Dang, when I checked the thread this morning I overlooked page 2 and did not notice how far you all had gotten already.
-
Mike Hale
custom shape point data
norm wrote:With a little experimentation I've discovered the problem lies with paths created with csh shapes
No, I can tell you from experience that not all paths created from shapes have that problem. And some paths that didn't come from shape have that problem. I think is has more to do with which app created the path. It is true that a lot of shapes in csh files have this problem but I think that is because the paths were created in Illustrator.
Anyway, I occurred to me last night that if the problem is a script can get all the points but gets the operation wrong then all we have to do is replace the operation in the array with the correct operation. This array was created from the 'problem' path in your sample. I changed the 4 inner subPaths operation from 1097098272( add ) to stringIDTypeID('xor') and it now creates a correct shape/path.
Code: Select allvar shapeArray = [[[[800.995174467564, 784.983918964863], [800.995174467564, 784.983918964863], [848.242373168468, 784.983918964863], false],
[[549.0091817379, 784.983918964863], [549.0091817379, 784.983918964863], [549.0091817379, 784.983918964863], false],
[[549.0091817379, 343.017694413662], [549.0091817379, 343.017694413662], [549.0091817379, 343.017694413662], false],
[[863.991184949875, 343.017694413662], [863.991184949875, 343.017694413662], [863.991184949875, 343.017694413662], false],
[[863.991184949875, 721.845724880695], [863.991184949875, 769.198992431164], [863.991184949875, 721.845724880695], false], true, 1097098272],// leave this to add
[[[745.873188197613, 690.276438832283], [758.920056581497, 690.276438832283], [732.826404631138, 690.276438832283], true],
[[769.496787548065, 666.599364042282], [769.496787548065, 653.523276209831], [769.496787548065, 679.676396906376], true],
[[745.873188197613, 642.923297286034], [732.826404631138, 642.923297286034], [758.920056581497, 642.923297286034], true],
[[722.24967366457, 666.599364042282], [722.24967366457, 679.676396906376], [722.24967366457, 653.523276209831], true], true, stringIDToTypeID('xor')],// change all inner paths to xor
[[[580.507483839989, 674.49207931757], [580.507483839989, 674.49207931757], [580.507483839989, 674.49207931757], false],
[[612.005192220211, 674.49207931757], [612.005192220211, 674.49207931757], [612.005192220211, 674.49207931757], false],
[[612.005192220211, 706.061365365982], [612.005192220211, 706.061365365982], [612.005192220211, 706.061365365982], false],
[[643.5034943223, 706.061365365982], [643.5034943223, 706.061365365982], [643.5034943223, 706.061365365982], false],
[[643.5034943223, 674.49207931757], [643.5034943223, 674.49207931757], [643.5034943223, 674.49207931757], false],
[[675.001881241798, 674.49207931757], [675.001881241798, 674.49207931757], [675.001881241798, 674.49207931757], false],
[[675.001881241798, 642.923297286034], [675.001881241798, 642.923297286034], [675.001881241798, 642.923297286034], false],
[[643.5034943223, 642.923297286034], [643.5034943223, 642.923297286034], [643.5034943223, 642.923297286034], false],
[[643.5034943223, 611.353948235512], [643.5034943223, 611.353948235512], [643.5034943223, 611.353948235512], false],
[[612.005192220211, 611.353948235512], [612.005192220211, 611.353948235512], [612.005192220211, 611.353948235512], false],
[[612.005192220211, 642.923297286034], [612.005192220211, 642.923297286034], [612.005192220211, 642.923297286034], false],
[[580.507483839989, 642.923297286034], [580.507483839989, 642.923297286034], [580.507483839989, 642.923297286034], false], true, stringIDToTypeID('xor')],
[[[832.492798030376, 374.586476445198], [832.492798030376, 374.586476445198], [832.492798030376, 374.586476445198], false],
[[580.507483839989, 374.586476445198], [580.507483839989, 374.586476445198], [580.507483839989, 374.586476445198], false],
[[580.507483839989, 579.785166203976], [580.507483839989, 579.785166203976], [580.507483839989, 579.785166203976], false],
[[832.492798030376, 579.785166203976], [832.492798030376, 579.785166203976], [832.492798030376, 579.785166203976], false], true, stringIDToTypeID('xor')],
[[[808.8698772192, 627.138370752335], [795.823093652725, 627.138370752335], [821.917339324951, 627.138370752335], true],
[[785.246277868748, 650.815508544445], [785.246277868748, 663.891533374786], [785.246277868748, 637.738916695118], true],
[[808.8698772192, 674.49207931757], [821.917339324951, 674.49207931757], [795.823093652725, 674.49207931757], true],
[[832.492798030376, 650.815508544445], [832.492798030376, 637.738916695118], [832.492798030376, 663.891533374786], true], true, stringIDToTypeID('xor')]];
No, I can tell you from experience that not all paths created from shapes have that problem. And some paths that didn't come from shape have that problem. I think is has more to do with which app created the path. It is true that a lot of shapes in csh files have this problem but I think that is because the paths were created in Illustrator.
Anyway, I occurred to me last night that if the problem is a script can get all the points but gets the operation wrong then all we have to do is replace the operation in the array with the correct operation. This array was created from the 'problem' path in your sample. I changed the 4 inner subPaths operation from 1097098272( add ) to stringIDTypeID('xor') and it now creates a correct shape/path.
Code: Select allvar shapeArray = [[[[800.995174467564, 784.983918964863], [800.995174467564, 784.983918964863], [848.242373168468, 784.983918964863], false],
[[549.0091817379, 784.983918964863], [549.0091817379, 784.983918964863], [549.0091817379, 784.983918964863], false],
[[549.0091817379, 343.017694413662], [549.0091817379, 343.017694413662], [549.0091817379, 343.017694413662], false],
[[863.991184949875, 343.017694413662], [863.991184949875, 343.017694413662], [863.991184949875, 343.017694413662], false],
[[863.991184949875, 721.845724880695], [863.991184949875, 769.198992431164], [863.991184949875, 721.845724880695], false], true, 1097098272],// leave this to add
[[[745.873188197613, 690.276438832283], [758.920056581497, 690.276438832283], [732.826404631138, 690.276438832283], true],
[[769.496787548065, 666.599364042282], [769.496787548065, 653.523276209831], [769.496787548065, 679.676396906376], true],
[[745.873188197613, 642.923297286034], [732.826404631138, 642.923297286034], [758.920056581497, 642.923297286034], true],
[[722.24967366457, 666.599364042282], [722.24967366457, 679.676396906376], [722.24967366457, 653.523276209831], true], true, stringIDToTypeID('xor')],// change all inner paths to xor
[[[580.507483839989, 674.49207931757], [580.507483839989, 674.49207931757], [580.507483839989, 674.49207931757], false],
[[612.005192220211, 674.49207931757], [612.005192220211, 674.49207931757], [612.005192220211, 674.49207931757], false],
[[612.005192220211, 706.061365365982], [612.005192220211, 706.061365365982], [612.005192220211, 706.061365365982], false],
[[643.5034943223, 706.061365365982], [643.5034943223, 706.061365365982], [643.5034943223, 706.061365365982], false],
[[643.5034943223, 674.49207931757], [643.5034943223, 674.49207931757], [643.5034943223, 674.49207931757], false],
[[675.001881241798, 674.49207931757], [675.001881241798, 674.49207931757], [675.001881241798, 674.49207931757], false],
[[675.001881241798, 642.923297286034], [675.001881241798, 642.923297286034], [675.001881241798, 642.923297286034], false],
[[643.5034943223, 642.923297286034], [643.5034943223, 642.923297286034], [643.5034943223, 642.923297286034], false],
[[643.5034943223, 611.353948235512], [643.5034943223, 611.353948235512], [643.5034943223, 611.353948235512], false],
[[612.005192220211, 611.353948235512], [612.005192220211, 611.353948235512], [612.005192220211, 611.353948235512], false],
[[612.005192220211, 642.923297286034], [612.005192220211, 642.923297286034], [612.005192220211, 642.923297286034], false],
[[580.507483839989, 642.923297286034], [580.507483839989, 642.923297286034], [580.507483839989, 642.923297286034], false], true, stringIDToTypeID('xor')],
[[[832.492798030376, 374.586476445198], [832.492798030376, 374.586476445198], [832.492798030376, 374.586476445198], false],
[[580.507483839989, 374.586476445198], [580.507483839989, 374.586476445198], [580.507483839989, 374.586476445198], false],
[[580.507483839989, 579.785166203976], [580.507483839989, 579.785166203976], [580.507483839989, 579.785166203976], false],
[[832.492798030376, 579.785166203976], [832.492798030376, 579.785166203976], [832.492798030376, 579.785166203976], false], true, stringIDToTypeID('xor')],
[[[808.8698772192, 627.138370752335], [795.823093652725, 627.138370752335], [821.917339324951, 627.138370752335], true],
[[785.246277868748, 650.815508544445], [785.246277868748, 663.891533374786], [785.246277868748, 637.738916695118], true],
[[808.8698772192, 674.49207931757], [821.917339324951, 674.49207931757], [795.823093652725, 674.49207931757], true],
[[832.492798030376, 650.815508544445], [832.492798030376, 637.738916695118], [832.492798030376, 663.891533374786], true], true, stringIDToTypeID('xor')]];
-
norm
custom shape point data
@mike Ive been attempting to load the shape array from external sources and also as an argument from another function with no success so far.The data is being send but the for some reason it wont rebuild the path unless the array is hand coded in the jsx file.
I was trying to read the array from a local text file then pass it to the createPath2012 to be created but it wont play ball. Any ideas?
I was trying to read the array from a local text file then pass it to the createPath2012 to be created but it wont play ball. Any ideas?
-
Mike Hale
custom shape point data
Here is one easy way. I omitted the support function, but you should get the idea. In my test the jsxinc file only had the array we have been using but there could be as many as you need.
Code: Select all// arrays declared in external file
var pathDeclareFile= new File('~/desktop/myPaths.jsxinc');
$.evalFile(pathDeclareFile);// load the variables defined in the include file
// use the one you need.
var tempPath = createPath2012(shapeArray12,'tempPath1');
If you don't want to use an include file, then I guess you would read the text file into a variable then do an eval to convert it back to an array. Might also have to deal with quotes.
I don't follow the part about using another function but I don't see why that wouldn't work if the function was returning an array with the needed structure.
Code: Select all// arrays declared in external file
var pathDeclareFile= new File('~/desktop/myPaths.jsxinc');
$.evalFile(pathDeclareFile);// load the variables defined in the include file
// use the one you need.
var tempPath = createPath2012(shapeArray12,'tempPath1');
If you don't want to use an include file, then I guess you would read the text file into a variable then do an eval to convert it back to an array. Might also have to deal with quotes.
I don't follow the part about using another function but I don't see why that wouldn't work if the function was returning an array with the needed structure.