Sg2.9
Problem with Tablet Data
Recent RSS
Problem with Tablet Data
From:  Chris Deutsch
Date:  20. February 2010, 21:21

Hi!

Accessing tabletData seems to have changed from

path.tabletData[i].offset
path.tabletData[i].value

to

path.tabletData[i][0]
path.tabletData[i][1]

But updating the script was pretty quick. Is there a difference between tabletData and tabletPressure? I still can't access and change the tablet data mentioned in the reference:

tabletBarrelPressure
tabletTilt
tabletBearing
tabletRotation

This is my script (how do you format scripts in this forum?):

p = document.getItems(Path,{selected: true})[0];
td = p.tabletData;
tp = p.tabletPressure;
tbp = p.tabletBarrelPressure;
tt = p.tabletTilt;
tb = p.tabletBearing;
tr = p.tabletRotation;
if(td){
	print("Data:");
	for(var j = 0; j < td.length; j++){
		print(td[j][0] + " - " + td[j][1]);
	}
}
if(tp){
	print("Pressure:");
	for(var j = 0; j < tp.length; j++){
		print(tp[j][0] + " - " + tp[j][1]);
	}
}
if(tbp){
	print("Barrel Pressure:");
	for(var j = 0; j < tp.length; j++){
		print(tbp[j][0] + " - " + tbp[j][1]);
	}
}
if(tt){
	print("Tilt:");
	for(var j = 0; j < tt.length; j++){
		print(tt[j][0] + " - " + tt[j][1]);
	}
}
if(tb){
	print("Bearing:");
	for(var j = 0; j < tb.length; j++){
		print(tb[j][0] + " - " + tb[j][1]);
	}
}
if(tr){
	print("Rotation:");
	for(var j = 0; j < tr.length; j++){
		print(tr[j][0] + " - " + tr[j][1]);
	}
}

This will result in printing the tabletData and the tabletPressure (the same values) of the selected path, but not the tilt, the bearing, the rotation or the barrel pressure (what exactly is barrel pressure?).

How can I access and change these values? Thanks!

Chris

Re: Problem with Tablet Data
From:  Jürg Lehni
Date:  20. February 2010, 21:31

tabletData is deprecated and only there for backward compatibility. The reference currently shows that wrongly, I need to fix that. It returns the same as tabletPressure which is the new term for this. I am not sure how to get or set the other arrays as I have simply added them the way the SDK exposes them. I do not currently have a tablet here to play around with, so cannot check right now.

If they are not defined I would imagine they were not recorded by your tablet... Maybe it has to do with what kind of brush you are using also?

And I am not sure what tabletBarrelPressure represents. I will have to look into all this!

Re: Problem with Tablet Data
From:  Jürg Lehni
Date:  20. February 2010, 21:45

It appears that tabletBarrelPressure is called Stylus Wheel in the UI illustrator. I am considering renaming this before anybody starts using it, tabletWheel might be a better name...
The SDK says this: Stylus wheel pressure, also called tangential or barrel pressure.

Re: Problem with Tablet Data
From:  Chris Deutsch
Date:  20. February 2010, 21:46

Haha! I just saw that my brush in Illustrator wasn't set to record any tilt, bearing or rotation. Once I use the right calligraphic brush, Scriptographer started printing all the values! Excellent! Thanks, Jürg!

Re: Problem with Tablet Data
From:  Jürg Lehni
Date:  20. February 2010, 21:49

Oh, great to hear!
You can always set the values to something new, e.g.

path.tabletPressure = [[0, 0], [0.5, 1], [1, 0]];

Just make sure that the values go all the way from 0 to 1 in the offset.

Re: Problem with Tablet Data
From:  Chris Deutsch
Date:  23. February 2010, 15:11

Okay, after creating a calligraphic brush with the right specifications, I'm able to change them via script. But now there's a new problem. Changing one of the parameters automatically resets or erases all others.

My brush has these specs:
Angle: 0° - Tilt - Variation: 180°
Roundness: 50% - Bearing - Variation 50%
Diameter: 20pt - Pressure - Variation: 5pt

I draw a path with my Wacom stylus, that correctly records all parameters. The stroke is displayed correctly. I run this script:

p.tabletTilt = [[0,0],[1,0.5]];

The angle (tilt) of the stroke changes accordingly. The roundness (bearing) and the diameter (pressure) seem to be suddenly set to "Fixed", as if their data had been erased. If I set all parameters like this:

p.tabletTilt = [[0,0],[1,0.5]];
p.tabletPressure = [[0,0],[1,1]];
p.tabletBearing = [[0,0],[1,1]];

it's always the last specified parameter that is applied correctly. All others are reset. Even if I change the order, only the last is applied.

You can test this without a tablet by creating a brush with a fixed roundness of 1%, and a tilt-dependant angle (all other parameters can be fixed). Draw a brush stroke with your mouse and run a script that changes the tilt. The angle will change accordingly. Then run a script that first changes the tilt and then the pressure. The angle will be displayed at the default value (usually 0°), no matter what you set the tilt to.

If you could have a look at this behaviour, that would be great. Thanks!

Chris

Re: Problem with Tablet Data
From:  Jürg Lehni
Date:  23. February 2010, 15:22

For some silly reason the brush parameters cannot be changed in Illustrator if no tablet is present, so if you could attach a file here with such a brush inside that would be great. I shall then look into it.

Thanks!

Re: Problem with Tablet Data
From:  Chris Deutsch
Date:  23. February 2010, 15:32

No problem.

Re: Problem with Tablet Data
From:  Jürg Lehni
Date:  19. March 2010, 23:44

I just tried to test this but realised the file is damaged. There is something wrong with the web-server that sometimes seems to cause uploads to contain only the same byte throughout the whole file. Could send the file by email? thanks!

Re: Problem with Tablet Data
From:  Jürg Lehni
Date:  20. March 2010, 02:24

I found my old tablet and managed to fix this. This should work fine in the new version 2.7.040.

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Convert GPS .csv files to Illustrator paths 28.12.11