void
ArxDbgUiTdcSysReactors::doTransReactor()
{
    if (m_doTrans) {
        if (m_transReactor == NULL) {
            m_transReactor = new ArxDbgTransactionReactor;
            acutPrintf(_T("\nTransaction Reactor Spy Turned On ..."));
            ArxDbgUiTdcSysReactors::attachTransactionReactorToAll();
        }
    }
    else {
        if (m_transReactor != NULL) {
            ArxDbgUiTdcSysReactors::removeTransactionReactorFromAll();
            delete m_transReactor;
            m_transReactor = NULL;
            acutPrintf(_T("\nTransaction Reactor Spy Turned Off ..."));
        }
    }
}
void
initApp()
{
    acutPrintf(_T("AsdkProfileSample ARX Test; Type ProfileSample to execute"));
    
    // register a command with the AutoCAD command mechanism
    //
    acedRegCmds->addCommand(_T("AsdkProfileSample_COMMANDS"), _T("AsdkProfileSample"), _T("ProfileSample"), ACRX_CMD_MODAL, aFunction);

}
Example #3
0
//
// Obviously, we need to delete the database reactor associated
// with the destroyed doc.
//
void CDocReactor::documentToBeDestroyed(AcApDocument* pDoc)
{
#ifndef NDEBUG
	acutPrintf("\ndocumentToBeDestroyed: %s.\n", pDoc->fileName());
	acedPostCommandPrompt();
#endif
	detachDbReactor(pDoc->database());
	if(gpDlg)
		objDisplay("", NULL);
}
Example #4
0
void LSS10()
{
	CLogger::Print(_T("-------------| START LOGGING LESSONS 10 |--------------"));
	AcDbObjectId idCircle;
	Acad::ErrorStatus es;
	if (Acad::eOk != (es = createCircle(idCircle))) {
		acutPrintf(ACRX_T("Fail to call createCircle() function - Error: %s")
									, acadErrorStatusText(es));
	}
}
//If the draworder has been changed, regen the drawing 
//
void  adskDocReactor::documentLockModeChanged(AcApDocument* pDoc, AcAp::DocLockMode myPreviousMode, 
			AcAp::DocLockMode myCurrentMode, AcAp::DocLockMode currentMode, const char* pGlobalCmdName)
{
	if(pGlobalCmdName[0]=='#'&& gbDraworderChanged == true)
	{
		ads_regen();
		acutPrintf("regened change mode");
		gbDraworderChanged = false;
	}
}
Example #6
0
// Used to set the AsdkPoly static variable mUseDragData for determining
// whether AsdkPoly will use the no-clone-for-dragging mechanism or not.
//
void setUseDragData()
{
    int val, status;
    for(;;) {
        acutPrintf("\nNew value for USEDRAGDATA <%s>: ",
            AsdkPoly::useDragData() ? "1" : "0");
        status = acedGetInt(NULL, &val);
        if (status != RTNORM)
            break;

        if (val != 0 && val != 1) {
            acutPrintf("\nValue must be 0 or 1");
            continue;
        }
        
        AsdkPoly::setUseDragData(val == 1 ? true : false);
        break;
    }
}
void
ArxDbgEditorReactor::sysVarChanged(const char* varName, Adesk::Boolean success)
{
    CString str;

    str.Format(_T("Sysvar Changed: %s"), varName);
    printReactorMessage(str);
    if (success != Adesk::kTrue)
        acutPrintf(_T("\n*** SYSVAR NOT CHANGED SUCCESSFULLY!!! ***"));
}
Example #8
0
    // 加载图元模块
    bool loadGEModule()
    {
        acutPrintf( _T( "\n-------- 加载图元模块 ------------\n" ) );

        if( !loadArxModule( _T( "MineGE" ) ) ) return false;
        if( !loadArxModule( _T( "GasGE" ) ) ) return false;
        if( !loadArxModule( _T( "ContourGE" ) ) ) return false;

        return true;
    }
void
ArxDbgTransientEntReactor::copied(const AcDbObject* obj, const AcDbObject* newObj)
{
    CString str;

    printReactorMessage(_T("Copied"), obj);
    acutPrintf(_T("\n%-15s : {%-18s: %s, %s} "), _T(""), _T("New Object"),
            ArxDbgUtils::objToClassStr(newObj), ArxDbgUtils::objToHandleStr(newObj, str));
    ArxDbgUiTdcTransientReactors::doStateDboxCopied(obj, newObj);
}
Example #10
0
//////////////////////////////////////////////////////////////
//
// Rx interface
//
//////////////////////////////////////////////////////////////
void initApp()
{

    acedRegCmds->addCommand( /*NOXLATE*/"ASDK_PROGRESSBAR",  // Group name
                                        /*NOXLATE*/"ASDK_PROGBAR",      // Global function name
                                        "progbar",                      // Local function name
                                        ACRX_CMD_MODAL,                 // Type
                                        &Test );                        // Function pointer
    acutPrintf( ".OK!\n" );
}
Example #11
0
	//-------------------------------------------------------------------------------------------
	// 
	//  功能: 向层表中添加记录(创建新层)
	//                 
	//
	//  作者:Qin H.X.
	//
	// 日期:200709
	//
	//  历史:无
	//
	//----------------------------------------------------------------------------------------------
	// - CGDCH03.AddLayer command (do not rename)
	static void CGDCH03AddLayer(void)
	{
		//先声明一个空的层表指针
		AcDbLayerTable *pLayerTbl;  
		//通过当前图形数据库获取层表对象指针
		//打开层表为写入状态
		acdbHostApplicationServices()->workingDatabase()  ->getSymbolTable(pLayerTbl, AcDb::kForWrite); 

		//判断层是否已经存在
		if(!pLayerTbl->has(_T("MyLayer"))) {   
			//新层表记录
			AcDbLayerTableRecord *pLayerTblRcd=  new AcDbLayerTableRecord;
			pLayerTblRcd->setName(_T("MyLayer"));   //设定图层名
			pLayerTblRcd->setIsFrozen(0);   // 图层解冻
			pLayerTblRcd->setIsOff(0);      // 打开图层
			pLayerTblRcd->setVPDFLT(0);   // 使用默认视口
			pLayerTblRcd->setIsLocked(0);   // 图层解锁
			// AcCmColor是ACAD颜色管理类
			AcCmColor color;    
			color.setColorIndex(1);  
			// 图层颜色为红色    
			pLayerTblRcd->setColor(color);  
			// 为给新图层设置线型,要得到线型表记录的ID。
			//  以下的代码演示如何得到并操作记录ID
			AcDbLinetypeTable *pLinetypeTbl;
			AcDbObjectId ltId;
			acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pLinetypeTbl, AcDb::kForRead);
			if ((pLinetypeTbl->getAt(_T("DASHED"), ltId))!= Acad::eOk)	{  
				acutPrintf(_T("\n未发现DASHED线型使用CONTINUOUS线型"));
				// 每一个不完全空的图形数据库的线型表中都有线型名为CONTINUOUS 的默认记录
				pLinetypeTbl->getAt(_T("CONTINUOUS"), ltId);
			}
			pLinetypeTbl->close();
			pLayerTblRcd->setLinetypeObjectId(ltId);
			pLayerTbl->add(pLayerTblRcd);
			pLayerTblRcd->close();
			pLayerTbl->close();
		} else {
			pLayerTbl->close();
			acutPrintf(_T("\n层已经存在"));
		}

	}
Example #12
0
HRESULT
AsdkSheetSet::addSheetSelectionSet(char* selSetName,			 // Name of selection set
					     		   char* selSetDesc,			 // Description 
							       IAcSmSheetSelSet **pSelSet) // Output pointer to selection set
{

	if(FAILED(isInitialized("addSheetSelectionSet")))
		return E_FAIL;
	
	 // lock the the database first before doing any operation on it
    if (FAILED(LockDatabase()))
	{
		acutPrintf("\n Database lock failed!");
        return E_FAIL;
	}

	CComPtr<IAcSmSheetSelSets> pSelSetS = NULL;
    if (FAILED(m_pSheetSet->GetSheetSelSets(&pSelSetS)) || (pSelSetS == NULL))
    {
		acutPrintf("\n addSheetSelectionSet failed! Cannot get selection sets!!");
        return E_FAIL;
    }
  

    // add a selection set to the selection set collection of the sheet set
    CComBSTR selSet(selSetName);
    CComBSTR selDesc(selSetDesc);

    if (FAILED (pSelSetS->Add(selSet, selDesc, pSelSet)))
    {
		acutPrintf("\n addSheetSelectionSet failed! Cannot add selection set %s!!", selSetName);
        return E_FAIL;
    }

	// Unlock database
	if (FAILED(UnlockDatabase())) 
	{
		acutPrintf("\n Cannot unlock database");
        return E_FAIL;
	}

    return S_OK;
}
Example #13
0
// get yes or no choice from the user
bool getYorN(char *msg)
{

	int res, retcode;
	char kw[4];
	acutPrintf("\n %s [Yes/No]", msg);
	do
	{
		acedInitGet(RSG_NONULL, "Yes No");
		retcode = acedGetInt(NULL, &res);
		switch (retcode)
		{
			case RTKWORD:
				if(acedGetInput(kw) != RTNORM)
				{
					acutPrintf("\nError getting Yes/No choice");
					return false;
				}

				if(strcmp(kw, "Yes") == 0)
				{
					return true;
				}
				else if(strcmp(kw, "No") == 0)
				{
					return false;	
				}
				else
				{
					acutPrintf("\nKeyword Error!!");
					return false;
				}
				break;
			default:
				acutPrintf("\n Enter <Yes/No> :");
				break;
			
		}
	} while(retcode != RTKWORD);
	
	return true;
	
}
Example #14
0
AcBr::ErrorStatus
brepDump(const AcBrBrep& brepEntity)
{ 
    AcBr::ErrorStatus returnValue = AcBr::eOk;

	// Validate the brep vs. the brep "owner"
	AcBrBrep brepOwner;
	returnValue = brepEntity.getBrep(brepOwner);
	if (returnValue != AcBr::eOk) {
		acutPrintf("\n Error in AcBrBrep::getBrep:");
		errorReport(returnValue);
		return returnValue;
	}
	if (!brepEntity.isEqualTo(&brepOwner)) {
		acutPrintf("\n Brep owner is out of sync with brep!");
		return (AcBr::ErrorStatus)Acad::eAmbiguousOutput;
	}

	// Query traversal direction for brep dump 
	Adesk::Boolean downwards = Adesk::kTrue;
    char opt[128];
   	while (Adesk::kTrue) {
		acutPrintf("\nSelect Traversal Direction for Brep Dump: ");
		acedInitGet(NULL, "Upwards Downwards");
		if (acedGetKword("Upwards/<Downwards>: ", opt) == RTCAN)
			return returnValue;

        // Map the user input to a valid traversal direction
		if ((strcmp(opt, "Downwards") == 0) || (strcmp(opt, "") == 0)) {
            downwards = Adesk::kTrue;
            break;
        } else if ((strcmp(opt, "Upwards") == 0)) {
            downwards = Adesk::kFalse;
            break;
	    }
    }

	// Switchable dump based on upwards vs. downwards traversal
	if (downwards) brepDumpDown(brepEntity);
	else brepDumpUp(brepEntity);

	return returnValue;
}
void
ArxDbgDatabaseReactor::printReactorMessage(const AcDbDatabase* db, LPCTSTR event, const AcDbObject* obj) const
{
    CString str, str2;
    ArxDbgUtils::objToHandleStr(obj, str);
    str2.Format(_T("<DB REACTOR: %p>"), db);
    
    acutPrintf(_T("\n%-15s : <%-18s: %s, %s> "), str2, event,
                        ArxDbgUtils::objToClassStr(obj), str);
}
Example #16
0
    virtual AcRx::AppRetCode On_kInitAppMsg (void *pkt) {
        AcRx::AppRetCode retCode =AcRxArxApp::On_kInitAppMsg (pkt) ;
        // TODO: Add your initialization code here

        acutPrintf("\n\nCommands: ");
        acutPrintf("\n-------------------------------------------");
        acutPrintf("\nADDSUBENTFILTER -> Add subentity selection filter");
        acutPrintf("\nSUBENTSEL -> Do subentity selection\n");
        acutPrintf("\nDELSUBENTFILTER -> Delete subentity selection filter\n\n");
        acutPrintf("\nADDSUBSELFILTER -> Add subselection filter");
        acutPrintf("\nRINGS -> Add Rings(custom entity)");
        acutPrintf("\nDELSUBSELFILTER -> Delete subselection filter\n");
        acutPrintf("\nDELFILTERS -> Delete all filters\n");

        return (retCode) ;
    }
Example #17
0
// 使用datalink比较的麻烦,也可以使用其它的方法
// 例如DataHelper中的get/set方法
void EvalDataExtractor_109::init()
{
    acutPrintf( _T( "\n109 -- 查找联络巷" ) );

    // 查找联络巷
    AcDbObjectIdArray objIds;
    ILTHelper ilt;
    if( !ilt.doILT( objIds ) ) return;

    int len = objIds.length();
    for( int i = 0; i < len; i++ )
    {
        AcDbObjectId objId = objIds[i];

        // 查找联络巷的入边和出边巷道
        AcDbObjectIdArray s1, s2;
        if( !ilt.findInOutEdges( objId, s1, s2 ) ) continue;

        ILTDataLink* pTN = new ILTDataLink();
        pTN->setDataSource( objId );
        if( !pTN->updateData( false ) )
        {
            delete pTN;
            break;
        }

        if( !s1.isEmpty() )
        {
            GetEdgeName( s1[0], pTN->inEdgeName ); // 获取入边巷道名称
        }
        if( !s2.isEmpty() )
        {
            GetEdgeName( s2[0], pTN->outEdgeName ); // 获取出边巷道名称
        }

        // 判断联络巷上是否有构筑物
        pTN->hasWall = HasGate( objId );

        ds.push_back( pTN );
    }
    acutPrintf( _T( "\n109 -- 查找完毕" ) );
}
Example #18
0
void CAddCADFrameMenu::AddSubMenu(const TCHAR* menuName, 
								  const TCHAR* command)
{
	if (m_menuCount == 0) {
#ifdef _DEBUG
		acutPrintf(_T("添加子菜单%s前没有调用AddMenu添加一个菜单条目!无法添加子菜单 "), menuName);
#endif
		return;
	}
	m_menus[m_menuCount-1]->AddMenu(menuName, command);
}
void Additional_Class::Change_TablePoint( AcDbObjectId TableID,AcGePoint3d newPt )
{
	AcDbEntity *pEnt_Temp;
	if (acdbOpenAcDbEntity(pEnt_Temp, TableID, AcDb::kForWrite)!= Acad::eOk)
	{
		acutPrintf(_T("\nOPEN TABLE ERROR"));
		return;
	}
	if (!pEnt_Temp->isKindOf(AcDbTable::desc()))
	{
		acutPrintf(_T("\nENTITY NOT TABLE"));
		return;
	}
	AcDbTable *pTableChange;
	pTableChange = AcDbTable::cast(pEnt_Temp);
	pTableChange->setPosition(newPt);
	pEnt_Temp->close();
	pTableChange->close();
	return;
}
Example #20
0
// Adds a reactor to the database to monitor changes.
// This can be called multiple times without any ill
// effect because subsequent calls will be ignored.
//
void
watchDb()
{
    if (gpDbr == NULL) {
        gpDbr = new AsdkDbReactor();
    }
    acdbHostApplicationServices()->workingDatabase()->addReactor(gpDbr);
    acutPrintf(
        "  Added Database Reactor to "
        "acdbHostApplicationServices()->workingDatabase().\n");
}
void Additional_Class::Change_TextPosition(AcDbObjectId TextID, AcGePoint3d ptText )
{
	AcDbEntity *pEnt_Temp;
	if (acdbOpenAcDbEntity(pEnt_Temp, TextID, AcDb::kForWrite) != Acad::eOk)
	{
		acutPrintf(_T("\nOPEN TEXT ERROR"));
		return;
	}
	if (!pEnt_Temp->isKindOf(AcDbText::desc()))
	{
		acutPrintf(_T("\nENTITY IS NOT TEXT"));
		return;
	}
	AcDbText *pTextUpChange;
	pTextUpChange = AcDbText::cast(pEnt_Temp);
	pTextUpChange->setPosition(ptText);
	pEnt_Temp->close();
	pTextUpChange->close();
	return;
}
Example #22
0
void CMyDlg::UpdateListCtr()
{
	acDocManager->lockDocument(curDoc());
	int nCount = m_ListCtr.GetItemCount();
	acutPrintf("%d\n", nCount);
	long lId;
	CString str;
	AcDbObjectId LineId;
	AcDbEntity *pEnt = NULL;
	AcDbLine *pLine = NULL;
	Acad::ErrorStatus es;
	
	if (nCount > 0)
	{
			for (int i = 0; i < nCount; ++i)
			{
				str = m_ListCtr.GetItemText(i, 0);
				lId = atol(str);
				LineId.setFromOldId(lId);
				//获得指针
				es = acdbOpenAcDbEntity(pEnt, LineId, AcDb::kForWrite);

				//检查是否被删除
				pLine = AcDbLine::cast(pEnt);
				if (es == Acad::eWasErased)
				{
					m_ListCtr.DeleteItem(i);
					--m_lLineCnt;
					--i;
					--m_Row;
				} 
				//检查颜色
				else if (es == Acad::eOk)
				{
					if (pLine)
					{
						str = m_ListCtr.GetItemText(i, 1);
						Adesk::UInt16 usColor = (Adesk::UInt16)atoi(str);
						if (pLine->colorIndex() != usColor)
						{
							char *buf = (char*)malloc(20);
							itoa((int)pLine->colorIndex(), buf, 10);
							m_ListCtr.SetItemText(i, 1, buf);
							free(buf);
						}
						pLine->close();
					}
				}						
			}
	}
	
	UpdateData(FALSE);
	acDocManager->unlockDocument(curDoc());
}
void
ArxDbgPersistentObjReactor::subObjModified(const AcDbObject* obj, const AcDbObject* subObj)
{
    CString str;

    printReactorMessage(_T("Sub-Obj Modified"), obj);
    acutPrintf(_T("\n%-15s : {%-18s: %s, %s} "), _T(""), _T("Sub Object"),
            ArxDbgUtils::objToClassStr(subObj), ArxDbgUtils::objToHandleStr(subObj, str));

    ArxDbgUiTdcPersistentReactors::doStateDboxSubObjModified(obj, subObj);
}
Example #24
0
//////////////////////////////////////////////////////////////
//
// Standard C Test function
//
//////////////////////////////////////////////////////////////
void Test()
{
    acutPrintf( "Running Progress Meter...\n" );

    acedSetStatusBarProgressMeter("Test Progress Bar", 0, 100);
    for(int i =0; i <= 100; i++) {
        Sleep(100);
        acedSetStatusBarProgressMeterPos(i);
    }
    acedRestoreStatusBar();
}
Example #25
0
void AppMenu::ClearMenu( IAcadPopupMenus* mnus, LPCTSTR menuname )
{
    long cnt = 0l;
    HRESULT hr = mnus->get_Count( &cnt );

    //now get Tools menu
    IAcadPopupMenu* toolsMenu = NULL;
    BSTR   tempName;
    VARIANT vtName;
    VariantInit( &vtName );

    bool found = false;
    for ( long i = 0; i < cnt; i++ )
    {
        vtName.vt = VT_I4;
        vtName.lVal = i;
        hr = mnus->Item( vtName, &toolsMenu );
        if ( FAILED( hr ) )
            return ;

        hr = toolsMenu->get_NameNoMnemonic( &tempName );
        CString mnuName( tempName );
        SysFreeString( tempName );
        if( mnuName.CompareNoCase( menuname ) == 0 )
        {
            found = true;
            break;
        }
    }

    if ( !found )
    {
        acutPrintf( _T( "没有找到菜单 : %s " ), menuname );
        return;
    }

    hr = toolsMenu->get_Count( &cnt );
    VARIANT vIndex;
    vIndex.vt = VT_I4;
    vIndex.lVal = cnt;
    IAcadPopupMenuItem* cmd1 = NULL;
    while( cnt-- )
    {
        vIndex.lVal = cnt;
        hr = toolsMenu->Item( vIndex, &cmd1 );
        hr = cmd1->Delete();
        cmd1->Release();
    }

    toolsMenu->RemoveFromMenuBar();
    toolsMenu->Release();

    mnus->RemoveMenuFromMenuBar( vtName );
}
void
shellTypeReport(AcBr::ShellType shellType)
{
    switch (shellType) {
	case(AcBr::kShellUnclassified):
		acutPrintf(ACRX_T(" Shell type cannot be determined at this time\n"));
		break;        
    case(AcBr::kShellExterior):
		acutPrintf(ACRX_T(" This is the exterior shell\n"));
		break;
    case(AcBr::kShellInterior):
		acutPrintf(ACRX_T(" This is an interior shell\n"));
		break;
	default:
		acutPrintf(ACRX_T(" Unexpected shell type encountered\n"));
		break;
	}

	return;
}
Example #27
0
void CutCommandMgr::registerCommands()
{
	acutPrintf(L"Begin register all commands supported, amount is [%d].\n",this->mSupportCommands.size());

	for(CommandIterator iter = this->mSupportCommands.begin(); iter != this->mSupportCommands.end(); iter++)
	{
		acutPrintf(L"\n");

		//画直线
		acedRegCmds->addCommand(CMD_CUT_GROUP,CMD_CUT_DRAWLINE,CMD_CUT_DRAWLINE,ACRX_CMD_TRANSPARENT,drawLine);
	}

	//填出对话框
	acedRegCmds->addCommand(CMD_CUT_GROUP,CMD_CUT_FILLPOINT,CMD_CUT_FILLPOINT,ACRX_CMD_TRANSPARENT,fillPoint);

	//画圆柱体
	acedRegCmds->addCommand(CMD_CUT_GROUP,CMD_LMHS_DRAW_CYLINDER,CMD_LMHS_DRAW_CYLINDER,ACRX_CMD_TRANSPARENT,drawCylinder);

	acutPrintf(L"DONE! Register all commands supported.\n",this->mSupportCommands.size());
}
Example #28
0
static void drawLines(ads_callback_packet* cpkt)
{
	acutPrintf(L"Get values for the fill points.\n");

	ACHAR pointsBuf[6][MAX_TILE_STR];

	ads_get_tile(cpkt->dialog,L"P1X",pointsBuf[0],MAX_TILE_STR);
	ads_get_tile(cpkt->dialog,L"P1Y",pointsBuf[1],MAX_TILE_STR);
	ads_get_tile(cpkt->dialog,L"P1Z",pointsBuf[2],MAX_TILE_STR);
	
	ads_get_tile(cpkt->dialog,L"P2X",pointsBuf[3],MAX_TILE_STR);
	ads_get_tile(cpkt->dialog,L"P2Y",pointsBuf[4],MAX_TILE_STR);
	ads_get_tile(cpkt->dialog,L"P2Z",pointsBuf[5],MAX_TILE_STR);

	acutPrintf(L"User fill points:\n");
	acutPrintf(L"Point 1 X[%s] Y[%s] Z[%s]:\n",pointsBuf[0],pointsBuf[1],pointsBuf[2]);
	acutPrintf(L"Point 2 X[%s] Y[%s] Z[%s]:\n",pointsBuf[3],pointsBuf[4],pointsBuf[5]);

	acutPrintf(L"DONE! Get values.\n");
}
Example #29
0
    virtual AcRx::AppRetCode On_kLoadDwgMsg( void* pkt )
    {
        AcRx::AppRetCode retCode = AcRxDbxApp::On_kLoadDwgMsg ( pkt ) ;

        // 从当前arx模块所在路径下读取最新的瓦斯地质图块定义
        UpdateDwgBlock();

        acutPrintf( _T( "\nDrawGasCmd::On_kLoadDwgMsg\n" ) );

        return retCode;
    }
Example #30
0
void
initApp()
{
    acutPrintf("AsdkSquare ARX application; Type SQ to execute");

    // register a command with the AutoCAD command mechanism
    //
    acedRegCmds->addCommand("SQUARE_COMMANDS", "ASDKSQUARE", 
							"SQ", ACRX_CMD_MODAL, aSquare);

}