|  | 
 
发表于 2019-9-5 21:34:00
|
显示全部楼层
 
| 比如一个直线的jig。
 #include "StdAfx.h"
 #include "zhflinejig.h"
 CZhfLineJig::CZhfLineJig()
 {
 }
 CZhfLineJig::~CZhfLineJig(void)
 {
 }
 // -----------------------------------------------------------------------------
 AcEdJig:ragStatus CZhfLineJig::sampler(void)
 {
 DragStatus stat;
 setUserInputControls((UserInputControls)
 (AcEdJig::kAccept3dCoordinates
 |AcEdJig::kGovernedByOrthoMode
 | AcEdJig::kNoNegativeResponseAccepted
 |AcEdJig::kAnyBlankTerminatesInput
 | AcEdJig::kNullResponseAccepted
 | AcEdJig::kNoZeroResponseAccepted));
 static AcGePoint3d axisPointTemp;
 stat = acquirePoint(m_pt3dCur, m_pt3dPre);
 if (axisPointTemp != m_pt3dCur)
 axisPointTemp = m_pt3dCur;
 else if (stat == AcEdJig::kNormal)
 return AcEdJig::kNoChange;
 return stat;
 }
 // -----------------------------------------------------------------------------
 Adesk::Boolean CZhfLineJig::update(void)
 {
 //         m_pZhfLine->put_m_pt3dEnd(m_pt3dCur) ;
 return Adesk::kTrue ;
 }
 // -----------------------------------------------------------------------------
 AcDbObjectId CZhfLineJig::append(void)
 {
 AcDbObjectId retCode =AcEdJig::append () ;
 return (retCode) ;
 }
 // -----------------------------------------------------------------------------
 AcDbEntity * CZhfLineJig::entity(void) const
 {
 return m_pZhfLine ;
 }
 void CZhfLineJig:oIt(void)
 {
 ads_point pt1 ;
 if (RTNORM==acedGetPoint(NULL, _T("\n指定起点:"), pt1))
 {
 AcGePoint3d pt_3d_start(pt1[0], pt1[1], pt1[2]) ;
 m_pZhfLine = new ZhfLine(pt_3d_start, pt_3d_start) ;
 m_pt3dPre = pt_3d_start ;
 setDispPrompt(_T("指定终点:"));
 DragStatus es = drag();
 if (es==DragStatus::kNormal)
 {
 m_pZhfLine->put_m_pt3dEnd(m_pt3dCur) ;
 append();
 }
 else if (m_pZhfLine!=NULL)
 {
 delete m_pZhfLine ;
 }
 }
 }
 | 
 |