Is there a way to retrieve the properties - namely the SelectionPointList - of a FreehandSelection from a script? I am hoping to create a script that allows for semi-interactive adjustments to an existing arbitrary point-to-point selection. I see how I can reset the selection - that will be easy. But I would like to start with providing the user with the list of points that are already made, and allowing her/him to adjust it.
Thanks in advance
Dean
Can I retrieve FreehandSelection point list?
Moderator: Kathy_9
-
dangelic0
- Posts: 36
- Joined: Sat Oct 22, 2011 4:07 pm
- System_Drive: C
- 32bit or 64bit: 64 Bit
- motherboard: Dell XPS 8920
- processor: Core i7-7700 4.2 GHx
- ram: 32GB
- Video Card: NVIDIA GeForce GTX 1060 6GB
- sound_card: Realtek High Definition Audio
- Hard_Drive_Capacity: 4 TB
- Monitor/Display Make & Model: LG Ultra HD
- Corel programs: PSP. VSP
-
LeviFiction
- Advisor
- Posts: 6831
- Joined: Thu Oct 02, 2008 1:07 pm
- System_Drive: C
- 32bit or 64bit: 64 Bit
- motherboard: Alienware M17xR4
- processor: Intel Core i7-3630QM CPU - 2_40GH
- ram: 6 GB
- Video Card: NVIDIA GeForce GTX 660M
- sound_card: Sound Blaster Recon3Di
- Hard_Drive_Capacity: 500GB
- Corel programs: PSP: 8-2023
- Location: USA
Re: Can I retrieve FreehandSelection point list?
From a current free-hand selection? No.
Freehand selections are converted to a raster selection so the points are lost. They also aren't kept in the command history.
I personally cannot think of any way to grab this information as you'd have to be grabbing it as the user is using the free-hand selection tool. Or they would have to be recording a script, save the selection to a quick script, or save the image as a PSPImage where you can read through the file format and find the history data. There is no good way that I can think of to grab this information in PSP.
Freehand selections are converted to a raster selection so the points are lost. They also aren't kept in the command history.
I personally cannot think of any way to grab this information as you'd have to be grabbing it as the user is using the free-hand selection tool. Or they would have to be recording a script, save the selection to a quick script, or save the image as a PSPImage where you can read through the file format and find the history data. There is no good way that I can think of to grab this information in PSP.
https://levifiction.wordpress.com/
-
dangelic0
- Posts: 36
- Joined: Sat Oct 22, 2011 4:07 pm
- System_Drive: C
- 32bit or 64bit: 64 Bit
- motherboard: Dell XPS 8920
- processor: Core i7-7700 4.2 GHx
- ram: 32GB
- Video Card: NVIDIA GeForce GTX 1060 6GB
- sound_card: Realtek High Definition Audio
- Hard_Drive_Capacity: 4 TB
- Monitor/Display Make & Model: LG Ultra HD
- Corel programs: PSP. VSP
Re: Can I retrieve FreehandSelection point list?
OK. Good to know. I was trying to start out with an approximate selection hand drawn, and then have the script display the corner points, and accept input from the user to nudge them to the exact points I want.
What I may do instead is something like:
* start with no selection
* solicit the user for a set of points; use them to make the FreeHand selection
* maintain the points within script variables, and
* then solicit the user for adjustments
Trying to create a script I can use to hand draw a "Low Poly" covering of an image
I hope it works
What I may do instead is something like:
* start with no selection
* solicit the user for a set of points; use them to make the FreeHand selection
* maintain the points within script variables, and
* then solicit the user for adjustments
Trying to create a script I can use to hand draw a "Low Poly" covering of an image
I hope it works
Re: Can I retrieve FreehandSelection point list?
GetRasterSelectionRect might work for you. It will work with a freehand selection and provide points that encompass an irregular selection.
In the selection shown, the Start point is (66,138).
The End point would be (216, 257) : (66 + 150) and (138 + 119)

Code: Select all
# Freehand Selection
App.Do( Environment, 'FreehandSelection', {
'General': {
'Mode': App.Constants.SelectionOperation.Add,
'Antialias': True,
'Feather': 0,
'SampleMerged': False
},
'FreehandSelectionType': App.Constants.FreehandSelectionType.PointToPoint,
'Selection': [((146.5,244.5),),((66.5,212.5),),((77.5,142.5),),((165.5,138.5),),((127.5,177.5)
,),((215.5,242.5),),((155.5,256.5),),((145.5,246.5),)],
'Range': 10,
'TraceDistance': 3,
'Smoothing': 0,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((20,0,0),1)
}
})
Selection=App.Do( Environment, 'GetRasterSelectionRect')
print SelectionThe End point would be (216, 257) : (66 + 150) and (138 + 119)

