using GRIP_STRETCH command in acedCmds

using GRIP_STRETCH command in acedCmds

dajum
Participant Participant
1,413 Views
11 Replies
Message 1 of 12

using GRIP_STRETCH command in acedCmds

dajum
Participant
Participant

Trying to set this up in my objectARX code and not getting very far.  Doesn't seem to be any documentation for this.  Is there another way to go about doing this?

0 Likes
1,414 Views
11 Replies
Replies (11)
Message 2 of 12

moogalm
Autodesk Support
Autodesk Support

Can you please give us some context, how did you to get to this 'GRIP_STRETCH', a workflow in AutoCAD UI?, I don't see it is defined anywhere in our code base, I'm just wondering.

0 Likes
Message 3 of 12

thierry_prince
Advocate
Advocate
Hello,
In my mind, GRIP_STRETCH is not a "real" command.
When you move a grip on an object, the locking-unlocking process of the drawing is necessary to modify the object and GRIP_STRETCH is given as the command name : acDocManagerPtr()->lockDocument(pDoc, pGlobalCmdName,...)
I think, it is also necessary for the UNDO mechanism.
Cheers.
0 Likes
Message 4 of 12

dajum
Participant
Participant
I see that as the command name in an editor reactor (commandStarted/
CommandEnded) when I manually start the process by selecting an object
and picking the grip point.  I want to repeat it programatically.
0 Likes
Message 5 of 12

dajum
Participant
Participant

I don't see GRIP_STRETCH being much different than _MOVE or STRETCH  I can use both those, but their functionality doesn't work the same.  My code is just


    ads_point pt;
    pt[0] = origin.x;
    pt[1] = origin.y;
    pt[2] = origin.z;
    struct resbuf *Mv;
    Mv = acutBuildList(RTSTR, _T("STRETCH"), RTSTR, _T("_LAST"), RTSTR, _T(""),
        RTPOINT, pt, RTSTR, PAUSE, 0);
    acedCmdS(Mv);
    acedCommandS(RTNONE);
    acutRelRb(Mv);

 

Which works fine, it just doesn't work like I want it to.

0 Likes
Message 6 of 12

moogalm
Autodesk Support
Autodesk Support

Hi,

 

Thanks for your patience.

Cmd strings - grip_stretch|grip_move|grip_rotate|grip_scale|grip_mirror are not actual command as you see your regular command, these are internal to GRIP editor and are used to identify the current operation for the purpose of command start /end notification.

When user hots a grip, Grip editor intiaties various grip mode operation based user inputs, i.e,  for suppose user selects a Grip, and enters rotate command on ACAD Command Line, an equivalent Grip_Rotate operation is executed.
By default the grip action upon selecting a grip is Grip_Stretch.

0 Likes
Message 7 of 12

dajum
Participant
Participant

 I want to add code to start this functionality in software.  If I can't use GRIP_STRETCH, what can I do to mimic this functionality?  If the user can initiate action, there must be some way to initiate it in software.  Can we make the grip point show? Isn't there something in the API that can help?

0 Likes
Message 8 of 12

tbrammer
Advisor
Advisor

While you are perfoming a grip dragging or stretch operation, AutoCAD calls

AcDbEntity::moveGripPointsAt (AcDbIntArray &, AcGeVector3d&);
AcDbEntity::moveGripPointsAt (AcDbVoidPtrArray&, AcGeVector3d&, int);
or
Acad::ErrorStatus AcDbEntity::moveStretchPointsAt(
    const AcDbIntArray & indices, 
    const AcGeVector3d& offset
);

for the entity beeing dragged.

The ARX docs state that it is possible to call these methods in an ARX application as well. I've never tried it - but I think this might work.
You will face the problem that you have to find out which grip index you want to move. But I think for a polyline this should be quite straightforward.


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

0 Likes
Message 9 of 12

dajum
Participant
Participant

I have a custom object that implements those functions and they are called during the grip stretch.  But I'm hoping to get the system to make that call and not have to write my own function to do it.  They are fairly complex to write and seem like such a waste when I know the system already does it.  That is the point here, not having to rewrite everything from scratch.  Seems like there should be a way to start up things that can be started by the user.

0 Likes
Message 10 of 12

Kyudos
Advisor
Advisor

I've found this to be the case with a lot of AutoCAD's 'standard' behaviours - the tools are there to replicate them, but in a lot of cases you have to re-code them from scratch rather than re-using the existing stuff. Drawing/dimension jigs for example.

 

As you say, its annoying to have to re-code something entirely just to replicate existing functionality.

0 Likes
Message 11 of 12

tbrammer
Advisor
Advisor

From the users point of view a GRIP_STRECH requires to

  1. select one or more grip points of an entity  (giving indices)
  2. drag them (giving offset)

These actions are passed to AcDbEntity::moveGripPointAt(indices, offset).

This will also work for build-in entities. You don't need to implement a custom entity to use this mechanism.

But if you have implemented a custom entity, you definitely need to implement moveGripPointAt() if it shall support GRIP_STRETCH.

So the function you want to write just has to call AcDbEntity::moveGripPointAt(indices, offset) with proper indices and  offset.


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

0 Likes
Message 12 of 12

dajum
Participant
Participant

As I stated in the last post I have implemented those functions.  And to be more specific, all of the grip point functions are implemented in my custom entity.  The question I'm looking for an answer to is how to get these functions called without writing a jig to call them myself.  grip_stretch uses them but isn't part of the API.  Is there some other function that is?  The purpose of the acedCmds function is to call functions to do what the user can do.  It seems there should be a way to start this particular process via acedCmds.

0 Likes