Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
I've done a few macros that ask the user to select a couple of points on a drawing and then the macro draws something based on the position of the points.
The problem is that despite adding 'select none' into the macro, a line at one of the selected points always remains selected after the macro has finished.
I've done a minimalist version below to illustrate the point.
macro test_select
message "Pick a point on your drawing"
define me as MouseEvent
define start_x as point
define start_y as point
me = Wait MouseClick
start_x = me.ptMMGrid.x
start_y = me.ptMMGrid.y
create line (start_x + 10) (start_y + 10) (start_x + 25) (start_y + 25)
select none
end macro
Theres no problem if you just pick an empty point on the drawing, but if the cursor snaps to a line or ellipse, that line or ellipse becomes selected and remains so after the macro finishes.
Is there a way to stop this?
A quick, untested suggestion, is to insert another select none before creating the line.
Thanks Trevor
I originally had a select none both before and after creating the line but as it didn't work, I took one of them out!
Hi
macro test_select
message "Pick a point on your drawing"
define me as MouseEvent
define start_x as point
define start_y as point
me = Wait MouseClick
start_x = me.ptMMGrid.x
start_y = me.ptMMGrid.y
create line (start_x + 10) (start_y + 10) (start_x + 25) (start_y + 25)
select none
"write macro for selecting any text - just to divert selection"
select none
end macro
This is an untested answer.
I hope this works
Thanks Vaduga (or is it Nathan?) and welcome to the forums.
I'll have a try using your suggestion of adding a bit to the macro to select again before exiting and see if it works
Hello Tim,
macro test_select
message "Pick a point on your drawing"
define me as MouseEvent
define start_x as point
define start_y as point
me = Wait MouseClick
start_x = me.ptMMGrid.x
start_y = me.ptMMGrid.y
create line (start_x + 10) (start_y + 10) (start_x + 25) (start_y + 25)
select none
CUT
Paste_samePosition
Select none
end macro
Thanks & Regards
Vaduga