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




Пример заказного режима объектной привязки


Следующий пример демонстрирует создание заказных режимов объектной привязки:

#include "rxobject.h"

#include "ads.h"

#include "adslib.h"

#include "dbmain.h"

#include "dbents.h"

#include "dbosnap.h"

#include "acedinpt.h"

// Socket Osnap mode protocol extension class.

//

class AcmeSocketInfo : public AcDbCustomOsnapInfo {

public:

ACRX_DECLARE_MEMBERS(AcmeSocketInfo);

virtual Acad::ErrorStatus

getOsnapInfo(

AcDbEntity* pickedObject,

int gsSelectionMark,

const AcGePoint3d& pickPoint,

const AcGePoint3d& lastPoint,

const AcGeMatrix3d& viewXform,

AcArray<AcGePoint3d>& snapPoints,

AcArray<int>& geomIdsForPts,

AcArray<AcGeCurve3d>& snapCurves,

AcArray<int>& geomIdsForLines)

};

// This class is registered with AcRx, to be used by the host

// application to look up entity class-specific implementations.

//

ACRX_NO_CONS_DEFINE_MEMBERS(AcmeSocketInfo,AcDbCustomOsnapInfo);

Acad::ErrorStatus

AcmeSocketInfo::getOsnapInfo(

AcDbEntity*,

int,

const AcGePoint3d&,

const AcGePoint3d&,

const AcGePoint3d&,

AcArray<AcGePoint3d>& snapPoints,

AcArray<int>& geomIdsForPts,

AcArray<AcGeCurve3d>& snapCurves,

AcArray<int>& geomIdsForLines)

{

// Associate with AcDbEntity to define default behavior.

//

snapPoints.setLogicalLength(0);

geomIdsForPts.setLogicalLength(0);

snapLiness.setLogicalLength(0);

geomIdsForLines.setLogicalLength(0);

}

// Socket Osnap mode protocol extension object for AcDbLine.

//

class AcmeSocketForLine : public AcmeSocketInfo {

public:

virtual Acad::ErrorStatus

getOsnapInfo(

AcDbEntity* pickedObject,

int gsSelectionMark,

const AcGePoint3d& pickPoint,

const AcGePoint3d& lastPoint,

const AcGeMatrix3d& viewXform,

AcArray<AcGePoint3d>& snapPoints,

AcArray<int>& geomIdsForPts,

AcArray<AcGeCurve3d>& snapCurves,




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