Grips, grip-stretch and reactors...

Grips, grip-stretch and reactors...

JoistDetailer
Contributor Contributor
1,206 Views
9 Replies
Message 1 of 10

Grips, grip-stretch and reactors...

JoistDetailer
Contributor
Contributor

I have reactors that update mtext based on the size of a rectangle after it's been modified via grip_stretch.  Everything is working well so far.  Now, I'm trying to refine it so the user can't change the rectangle by stretching corners, because the rectangle must remain a rectangle.

 

I have been successful in identifying a corner grip stretch in my "vlr-CommandWillstart" reactor callback.  However, I have not been successful in cancelling the stretch.  I'm thinking that it's becasue the stretch has not actually *started* yet, so there is nothing to cancel?

 

I've tried something like this (from other forums - hat tip to Lee Mac), but it didn't work:

(vl-catch-all-apply 'vlax-invoke (list (vlax-create-object "WScript.Shell")'sendkeys "{ESC}"))

 

Here are my options in order of preference:

1) When rectangle is selected, only show midpoint grips (or disable corner grips).  This would be the cleanest way to do it (only present the user with "permitted" actions), but I don't know if this is possible or not.

2) If "1" is not possible, if corner grip is being stretched, cancel the grip-stretch.

3) Last resort, undo the corner grip-stretch (I already know how to do this).

 

Thanks in advance for any help in getting me pointed in the right direction!!

0 Likes
1,207 Views
9 Replies
Replies (9)
Message 2 of 10

Moshe-A
Mentor
Mentor

@JoistDetailer  hi,

 

take a look  >> at this thread << 

i test it and it works.

 

i would add a descriptive message to users so they know what is going on, otherwise they would think something is wrong with autocad.

 

moshe

 

 

 

moshe

 

0 Likes
Message 3 of 10

JoistDetailer
Contributor
Contributor

That's where I got code snipped that I gave the h/t to Lee Mac for.  I'll study it again, maybe I overlooked something.

 

...and, yes, I already have a message popping up to let the user know that stretching corners is not permitted.

 

Thanks for the response...

0 Likes
Message 4 of 10

JoistDetailer
Contributor
Contributor

...and yes, I *did* overlook something!

 

(vl-load-com)!!  Smiley Embarassed

 

However, I'd still like to see if my "preferred" method of NOT showing the corner grips is a possibility.

0 Likes
Message 5 of 10

JoistDetailer
Contributor
Contributor

However, I'd still like to see if my "preferred" method of NOT showing the corner grips is a possibility.

0 Likes
Message 6 of 10

Moshe-A
Mentor
Mentor

As far as i know (hope i'm not mistaken) you do not have control on grips except for turning them on/off (yes also their color and side) but i think as the user picks an object the grips are popup at the same time the reactor is activated.

 

 

 

0 Likes
Message 7 of 10

Kent1Cooper
Consultant
Consultant

Use a Block instead of a [Polyline] rectangle?  Depending on how universal the need is, you could even potentially re-define the RECTANG command to make a Block instead.  I'm not up on dynamic Blocks, but I expect one could be built that would allow adjustments without going through the scale entries in Properties, but would always remain rectangular.

Kent Cooper, AIA
0 Likes
Message 8 of 10

JoistDetailer
Contributor
Contributor

Kent,

I may consider that, but the "rectangle only" may be a short-term limitation.  But, yes, I am looking into dynamic blocks for other purposes and using it for this purpose is an interesting idea.  It could potentially clean up my reactors significantly.

 

Thanks!

0 Likes
Message 9 of 10

JoistDetailer
Contributor
Contributor

Moshe-A,

I know that the grips are displayed before the CommandWillStart reactor fires.  I don't think there is a reactor for a "object selected" event, but I may be wrong.

 

Looks like the best I can do is my "option #2", which I've implemented and am mostly satisfied with.

 

However, I'm intrigued with your reference to controlling a grip's "color and side"...can you elaborate, please?

0 Likes
Message 10 of 10

Moshe-A
Mentor
Mentor

@JoistDetailer ,

 

i meant that you can change the color and size of the grips by sys vars:

 

GRIPS

GRIPSIZE

GRIPCOLOR

 

moshe

 

0 Likes