Exemplo n.º 1
0
bool CMakeBlkFile::SaveToFile()
{
	bool bRet = true;
	AcDbDatabase *pDwg = NULL; 
	Acad::ErrorStatus es;

	es = acdbHostApplicationServices()->workingDatabase()->wblock(pDwg, m_objIdArrs, m_insertPt/*, AcDb::kDrcIgnore*/);
	if (es == Acad::eOk)
	{
		AcDb::AcDbDwgVersion dwgVer = acdbHostApplicationServices()->workingDatabase()->originalFileVersion();
		es = pDwg->saveAs(m_strFileName,FALSE,dwgVer,0);
		if (es!=Acad::eOk)
		{
			bRet = false;
		}
	}
	if (pDwg != NULL)
	{
		delete pDwg;
		pDwg = NULL;
	}

	acTransactionManagerPtr()->queueForGraphicsFlush();
	acTransactionManagerPtr()->flushGraphics();//刷新
	acedUpdateDisplay();
	return bRet;
}
Exemplo n.º 2
0
void CDlgReadInfo::FlashEntity(AcDbObjectId ObjId) 
{ 
	LockDocument _Lock;

	AcDbEntity *pEnt=NULL; 
	AcTransaction* pTrans=actrTransactionManager->startTransaction();
	if(Acad::eOk != acdbOpenAcDbEntity(pEnt,ObjId,AcDb::kForWrite))
	{
		actrTransactionManager->endTransaction();
		return; 
	}
	pEnt->highlight(); 
	acedUpdateDisplay();


	DWORD dwCount=GetTickCount(); 
	while(1)
	{
		if(GetTickCount()-dwCount>=200) break;      
	}
	pEnt->unhighlight(); 
	acedUpdateDisplay();

	dwCount=GetTickCount(); 
	while(1)
	{
		if(GetTickCount()-dwCount>=200) break;      
	}
	pEnt->highlight(); 
	acedUpdateDisplay();
	dwCount=GetTickCount(); 
	while(1)
	{
		if(GetTickCount()-dwCount>=200) break;      
	}
	pEnt->unhighlight(); 
	acedUpdateDisplay();

	dwCount=GetTickCount(); 
	while(1)
	{
		if(GetTickCount()-dwCount>=200) break;      
	}
	pEnt->highlight(); 
	acedUpdateDisplay();
	dwCount=GetTickCount(); 
	while(1)
	{
		if(GetTickCount()-dwCount>=200) break;      
	}
	pEnt->unhighlight(); 
	acedUpdateDisplay();

	pEnt->close();

	actrTransactionManager->endTransaction();
}
void AcDbDoubleClickEditPline::startEdit(AcDbEntity *pEnt, AcGePoint3d clickpt)
{
	// Implement the startEdit notification handler to catch when
	// a user double-clicks a 'POLYLINE' entity
	
	// Get the Current Document
	AcApDocument *pDoc=acDocManager->curDocument(); 
	AcDbPolyline *pLine;
		
	// Cast the AcDbEntity pointer to AcDbPolyline
	if(pEnt->isKindOf(AcDbPolyline::desc()) == Adesk::kTrue)
		pLine=AcDbPolyline::cast(pEnt);
	else
	{
		acutPrintf("Error: Invalid AcDbPolyline Object");
		return;
	}
	
	acDocManager->lockDocument(pDoc,AcAp::kWrite);
	
	// Upgrade to write
	if(pLine->upgradeOpen()!=Acad::eOk)
	{
		acutPrintf("Error: Could Not open AcDbPolyline Object");
		return;
	}
	
	// iterate through all the vertices to find which
	// segment was clicked on, and place a vertex there.
	for(unsigned int c=0;c<pLine->numVerts()-1;c++)
	{
		AcGePoint3d pt1,pt2;
		pLine->getPointAt(c,pt1);
		pLine->getPointAt(c+1,pt2);
		AcGeVector3d lineVec(pt2-pt1),clickVec(clickpt-pt1),
			clickVec2(pt2-clickpt);
		double ang=lineVec.angleTo(clickVec);
		
		// This is the filter...
		// .05 (5% of lineVec length) is an arbitrary length...
		if((sin(ang)*clickVec.length()<.05*lineVec.length()) && 
			clickVec.length()<lineVec.length() && 
			clickVec2.length()<lineVec.length()) 
		{
			// Add the point Here!
			ads_point outPt;
			acdbWcs2Ecs(asDblArray(clickpt),outPt,asDblArray(pLine->normal()),Adesk::kFalse);	
			pLine->addVertexAt(c+1,asPnt2d(outPt));
			break;
		}
	}
	
	pLine->close();

	acDocManager->unlockDocument(pDoc);
	
	// invoking acedSSSetFirst(NULL,NULL) here will clear the
	// pickfirst selection, if desired (not With pline though).
	//acedSSSetFirst(NULL,NULL);
	
	// Update the graphics...
	pLine->draw();
	actrTransactionManager->flushGraphics();
	acedUpdateDisplay();
}
Exemplo n.º 4
0
static void ForceUpdate()
{
    actrTransactionManager->queueForGraphicsFlush();
    actrTransactionManager->flushGraphics();
    acedUpdateDisplay();
}