ObjectARX, AutoCAD. Среда программирования библиотеки C++


Типовой Код - часть 3


switch (mPromptCounter) {

case 0:

// At this time, mAxis contains the value of one

// endpoint of the desired major axis. The

// AcDbEllipse class stores the major axis as the

// vector from the center point to where the axis

// intersects the ellipse path (such as half of the true

// major axis), so we already have what we need.


mMajorAxis = mAxisPt - mCenterPt;


case 1:

// Calculate the radius ratio. mRadiusRatio

// currently contains the distance from the ellipse

// center to the current pointer position. This is

// half of the actual minor axis length. Since

// AcDbEllipse stores the major axis vector as the

// vector from the center point to the ellipse curve

// (half the major axis), to get the radius ratio we

// simply divide the value currently in mRadiusRatio

// by the length of the stored major axis vector.


mRadiusRatio = mRadiusRatio / mMajorAxis.length();



// Now update the ellipse with the latest setting.


mpEllipse->set(mCenterPt, mNormal, mMajorAxis,


return Adesk::kTrue;


// This function must be implemented to return a pointer to

// the entity being manipulated by the jig.



AsdkEllipseJig::entity() const


return mpEllipse;


// This function uses the AcEdJig mechanism to create and

// drag an ellipse entity. The creation criteria are

// slightly different from the AutoCAD command. In this

// case, the user selects an ellipse center point and

// drags to visually select the major and minor axes

// lengths. This sample is somewhat limited; if the

// minor axis ends up longer than the major axis, then the

// ellipse will just be round because the radius ratio

// cannot be greater than 1.0.





// First, have the user select the ellipse center point.

// We don’t use the jig for this because there is

// nothing to see yet.


AcGePoint3d tempPt;

struct resbuf rbFrom, rbTo;

acedGetPoint(NULL, "\nEllipse center point: ",

Содержание  Назад  Вперед