#include "stdafx.h" #include "TDbPipeMatchPropertiesReactor.h" TDbPipeMatchPropertiesReactor::TDbPipeMatchPropertiesReactor() { } TDbPipeMatchPropertiesReactor::~TDbPipeMatchPropertiesReactor() { } void TDbPipeMatchPropertiesReactor::endEntsel( Acad::PromptStatus returnStatus,AcDbObjectId& entPicked,AcGePoint3d& pickPoint,const char* pKeyword) { //acutPrintf(_T("\nTDbPipeMatchPropertiesReactor::endEntsel")); if (m_idSrc.isNull()) { AcDbEntity* pEnt = NULL; if (Acad::eOk == acdbOpenAcDbEntity(pEnt,entPicked,AcDb::kForRead)) { TDbInterfacesObj* pIntf = TDbInterfacesObj::cast(pEnt); if (pIntf != NULL) { m_idSrc = entPicked; } pEnt->close(); } } else { AcDbEntity* pEnt = NULL; AcDbEntity* pEnt2 = NULL; if (Acad::eOk == acdbOpenAcDbEntity(pEnt,m_idSrc,AcDb::kForRead)) { TDbInterfacesObj* pIntf = TDbInterfacesObj::cast(pEnt); if (pIntf != NULL) { if (Acad::eOk == acdbOpenAcDbEntity(pEnt2,entPicked,AcDb::kForRead)) { BOOL bOk = FALSE; AcDbCurve* pCurve = AcDbCurve::cast(pEnt2); if (pCurve != NULL) { bOk = TRUE; } pEnt2->close(); if (bOk) { pIntf->CopyPropertiesTo(entPicked,0); } } } pEnt->close(); } } } void TDbPipeMatchPropertiesReactor::ResetMatchProperties() { m_idSrc.setNull(); } void TDbPipeMatchPropertiesReactor::endSSGet(Acad::PromptStatus returnStatus,const AcArray& ss) { //acutPrintf(_T("\nTDbPipeMatchPropertiesReactor::endSSGet")); if (!m_idSrc.isNull() && ss.length() > 0) { AcDbEntity* pEnt = NULL; AcDbEntity* pEnt2 = NULL; if (Acad::eOk == acdbOpenAcDbEntity(pEnt,m_idSrc,AcDb::kForRead)) { TDbInterfacesObj* pIntf = TDbInterfacesObj::cast(pEnt); if (pIntf != NULL) { AcDbObjectIdArray arIDs; AcDbObjectId idPicked; for (int i = 0;i < ss.length();i++) { idPicked = ss.at(i); if (idPicked.asOldId() != m_idSrc.asOldId()) { if (Acad::eOk == acdbOpenAcDbEntity(pEnt2,idPicked,AcDb::kForRead)) { BOOL bOk = FALSE; AcDbCurve* pCurve = AcDbCurve::cast(pEnt2); if (pCurve != NULL) { bOk = TRUE; arIDs.append(idPicked); } pEnt2->close(); } } } if (arIDs.length() > 0) { pIntf->CopyPropertiesTo(arIDs,0); } } pEnt->close(); } } else { if (m_idSrc.isNull()) { curDoc()->inputPointManager()->removeInputContextReactor(this); struct resbuf* pSS1 = NULL,*pSS2 = NULL; acedSSGetFirst(&pSS1,&pSS2); if (pSS2 != NULL) { #if ADS > 20 int lLen = 0; #else long lLen = 0; #endif acedSSLength(pSS2->resval.rlname,&lLen); if (lLen > 0) { ads_name ent; acedSSName(pSS2->resval.rlname,0,ent); acdbGetObjectId(m_idSrc,ent); } } if (pSS1 != NULL) acutRelRb(pSS1); if (pSS2 != NULL) acutRelRb(pSS2); curDoc()->inputPointManager()->addInputContextReactor(this); #if ADS>16 if (ss.length() > 0) { m_idSrc = ss.first(); } #endif } } } void TDbPipeMatchPropertiesReactor::endGetPoint(Acad::PromptStatus returnStatus,const AcGePoint3d& pointOut,const TCHAR*& pKeyword) { #if ADS>16 if (m_idSrc.isNull()) { int nHorSize = ::GetSystemMetrics(SM_CXSCREEN); int nCursorSize = 5; struct resbuf rb; acedGetVar(_T("PICKBOX"),&rb); nCursorSize = rb.resval.rint; double dCursor = 0.0; int nCursorPixel = nCursorSize * nHorSize / 100; if (nCursorPixel > 0) { dCursor = PixelToWcs(nCursorPixel) * 0.5; } ads_point pt1,pt2; acdbWcs2Ucs(asDblArray(pointOut),pt1,false); pt1[X] -= 0.5 * dCursor; pt1[Y] -= 0.5 * dCursor; ads_point_set(pt1,pt2); pt2[X] += dCursor; pt2[Y] += dCursor; ads_name ss; acedSSGet(_T("C"),pt1,pt2,NULL,ss); #if ADS > 20 int lLen = 0; #else long lLen = 0; #endif // modify by cq 2017-01-05 Ö§³ÖCAD2017 acedSSLength(ss, &lLen); if (lLen > 0) { ads_name ent; acedSSName(ss,0,ent); //acdbGetObjectId(m_idSrc,ent); } acedSSFree(ss); } #endif } ////////////////////////////////////////////////////////////////////////// //add by dyw 2014-7-16 AcDbObjectIdArray TDbDuctStretchRactor::m_arrId; void TDbDuctStretchRactor::endSSGet(Acad::PromptStatus returnStatus,const AcArray& ss) { m_arrId.append(ss); }