Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ObjectARX Custom Object

1 view
Skip to first unread message

Alex Januszkiewicz

unread,
Jun 13, 2001, 2:46:56 AM6/13/01
to
Derive your entity from AcDbEntity instead of AcDbObject and implement the
following method for your custom object:

virtual Acad::ErrorStatus YourEntity::getGripPoints(AcGePoint3dArray&
gripPoints, AcDbIntArray& osnapModes, AcDbIntArray& geomIds) const;

getStretchPoints function that is called when the entity is stretched calls
gets stretch points by calling getGripPoints(..)

If you need stretch to behave differently, you can override default
implementation of getStretchPoints by defining your own:

virtual Acad::ErrorStatus YourEntity::getStretchPoints(AcGePoint3dArray&
stretchPoints) const;

All these details are in ObjectARX documentation.

--
Alex Januszkiewicz
IntelCAD Systems / DWG Data Recovery Services
Autodesk Authorized Developer
http://www.intelcad.com
* BLITZ! - Standalone Tools For Processing DWG/DXF *
* DWF => DWG converter for AutoCAD 2000(i)*
--


"jetskee" <jet...@hotmail.com> wrote in message
news:f0593...@WebX.maYIadrTaRb...
I want to create my own custom object in AutoCad using ObjectARX. I also
want to be able to control how the object is stretched when the user clicks
on it and tries to stretch it. Can someone point me in the right direction.
I am able to create my own object using AcDbObject. How do I trap the strech
function?


Byron Blattel

unread,
Jun 14, 2001, 11:15:56 AM6/14/01
to
Perhaps you should show us both the declaration and implementation code for the
class. Most of the time when derived class methods are not called it's because
the are not declared properly. Did you leave out the const in the declaration
of getStretchPoints() and getGripPoints()? Note that the default implementation
of getStretchPoints() calls getGripPoints() so you really only need to implement
getStretchPoints() if they differ from the grips.

Note also that unless you implement moveGripPointsAt() to handle the different
grips the default implementation will just move the object.

jetskee wrote:
>
> I tried that and my methods are not called when I click on the object and drag
> it.

--
|
----+----------------------------------------------
| Byron Blattel
| CADwerx---Applications for AutoCAD
| Autodesk Registered Developer
| email: by...@cadwerx.net
| web site: http://www.cadwerx.net
|

jetskee

unread,
Jun 14, 2001, 11:19:24 PM6/14/01
to
I have attached a file with the listing of my declaration and implementation. I place the object. Then click on it then grab a corner and stretch it. I would expect the message box in the code to pop up when the method is run.
GETGRIPPOINTS.TXT

Mike Riley

unread,
Jun 18, 2001, 4:59:41 PM6/18/01
to
I didn't take time to look at your implementation, but I noticed the second
argument in your getStretchPoints() doesn't match the ObjectARX dbmain.h
header file. In your declaration and implementation change it to
"stretchPoints".

Hope this helps,
Mike

jetskee <jet...@hotmail.com> wrote in message

news:f059...@WebX.maYIadrTaRb...
> Does this code look ok?
>


Mike Riley

unread,
Jun 20, 2001, 9:09:28 AM6/20/01
to
When you simply pick the object, getGripPoints() is not invoked?

jetskee <jet...@hotmail.com> wrote in message
news:f059...@WebX.maYIadrTaRb...

> I made the change but it still is not executed when I grab and stretch the
object
>


Mike Riley

unread,
Jun 22, 2001, 2:25:59 AM6/22/01
to
After looking closer at the code, I see some problems:
Looks like you're trying to draw the RectWindow object with its drawWindow()
method. Since drawWindow() simply creates and posts an AcDbPolyline to the
database, that's what you're getting: an AcDbPolyline. From the command
line, LIST the entity to see verify this. The AcDbPolyline's
getGripPoints() method is invoked when you pick it.

What you must do is override the necessary AcDbEntity methods, and post the
RectWindow object to the database.
You need to read about and override worldDraw() in your RectWindow class;
this is probably what you'll use to display the RectWindow on the screen.

The Developer's guide covers this in the sections about deriving custom
ObjectARX objects, and deriving from AcDbObject and AcDbEntity.
Additionally, some of the code samples (look at polysamp) included with the
ObjectARX SDK may help.

Mike

jetskee <jet...@hotmail.com> wrote in message
news:f059...@WebX.maYIadrTaRb...

> That is correct. I have code to display a message box in the getGripPoints
method. Also I have run it in debug mode with a breakpoint in the method and
the debugger never stops at that line. I seem to be following all the
directions in the Online manual but it just doesn't want to work.
>


0 new messages