Notifications
Clear all

[Closed] Wacom Tablet Pressure?

 PEN

Any one ever try to do this with dotNet? Been looking for a way and not finding much help out there about it in C#. I’m looking to do it in Max Script how ever.

22 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

i don’t think you can do anything without some .dll from the developer of the tablet. only .net can’t get this data. but using System.Runtime.InteropServices probably you can. maybe the developer has some .net support.
btw can the max get the pressure in its paint interface? if it can we have a chance.

 PEN

Denis, thePainterInterface might be able to do it but I have not looked at that in years. I’m not using it at the moment and have built my own brush system so I wanted to avoid it as I think that it would create more over head. I will see if I can just get the pressure from it without anything else.

Insanto, thanks for the link. I will have look at where that leads me.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

i don’t suggest to use the Paint Interface, i’m just curious can the interface read the pressure or not.

 PEN

Yes it can, getHitPointData will return a .str property which is the strength of the bush. Looks like more work then I might want for this tool at this time so I have it on the bottom of my list. Why do you suggest not using it. I did a number of years ago and it worked well at the time.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

no… i’m absolutely fine about using the paint interface. i just want to say that i’m not pushing you to use it.

 PEN

Ah, I do remember it being clunky to use. Don’t remember why but I have tended to avoid it. I think that I should probably have used it but I’m to far along with dead lines looming to care at this point. Will have a look at it again as soon as I have time and let you know how it works.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

i’ve made several tools with the paint interface. the last one was just two month ago. i didn’t meet any problem. everything works right in the max 2010/64 and 2012/64.

 PEN

Good stuff. I guess I should be using it as I would get a couple things for free that I’m going to have to work at. I will change it later how ever. Right now I’m doing my own hit testing and it is working really well.

The strength is not the same as the pressure. you have to check getHitPressureData. I remember that the interface didn’t return the right data for every device. But I didn’t care at that moment about the pressure.

Hi Paul,

I’m pretty sure WPF can read pressure values of a stylus device. Haven’t worked with it though.

Cheers,
o

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

yes, it can. WPF supports the stylus for all controls. here is a sample with window:


try(wp.close()) catch()

wp = dotnetobject "System.Windows.Window"
wp.WindowStartupLocation = wp.WindowStartupLocation.Manual

wp.Title = "Stylus in WPF Window"
wp.ShowInTaskbar = off
wp.Topmost = on
wp.Top = 200
wp.Left = 200
wp.Width = 400
wp.Height = 400

fn onStylusMove s e = 
(
	points = e.GetStylusPoints s
	for k=0 to points.count-1 do 
	(
		p = points.item[k]
		format "point:% pressure:% x:% y:%
" k p.PressureFactor p.X p.Y
	)
)
dotnet.addeventhandler wp "StylusMove" onStylusMove

wih = dotnetobject "System.Windows.Interop.WindowInteropHelper" wp
wih.owner = dotnetobject "IntPtr" (windows.GetMaxHWND())
wp.show()





 PEN

I will dig more with WPF, didn’t search specifically for it so I will see what I can find.

 PEN

Finally located this but don’t know what to do with it.


dotNetClass "System.Windows.Input.StylusPointProperties"

if has a normalPressure property that states that it returns the pressure on the tablet but I have not been able to get it to do that or find anything that tells me how it is to work.

Any one want to take a shot at it?

Page 1 / 2