删除标注关联仿dda命令DIMDISASSOCIATE

static void sk_ARXTestXDatamydimassoc(void)
	{
		// Add your code for command sk_ARXTestXData.mydimassoc here
		ads_name ent;
		ads_point pt;
		if (RTNORM != acedEntSel(_T("\n请选择标注:"),ent,pt))
		{
			return;
		}
		AcDbObjectId objId=AcDbObjectId::kNull;
		acdbGetObjectId(objId,ent);
		//智能指针打开
		AcDbObjectPointer<AcDbDimension> pDim(objId,AcDb::kForRead);
		if (Acad::eOk != pDim.openStatus())
		{
			return;
		}
		 
		void* pSomething;
		AcDbObjectReactor* pObjReactor;
		AcDbObject* obj;
		Acad::ErrorStatus es;

		es= pDim->upgradeOpen();
		if (es!= Acad::eOk)
		{
			return;
		}

		const AcDbVoidPtrArray* reactors = pDim->reactors();
		if (reactors == nullptr) 
			return;

		for (int i = 0; i < reactors->length(); i++)
		{
			pSomething = reactors->at(i);
			if (!acdbIsPersistentReactor(pSomething))
			{	
				continue;				
			}
			//永久反应器
			AcDbObjectId persReactorId=acdbPersistentReactorObjectId(pSomething);
			//智能指针打开对象
			AcDbObjectPointer<AcDbObject> obj(persReactorId,AcDb::kForRead);
			//es = acdbOpenObject(obj,persReactorId , AcDb::kForRead);
			if ((obj.openStatus() == Acad::eOk) && obj) 
			{
				CString str;
				str.Format(_T("%s"),obj->isA()->name());	
				if (str == _T("AcDbDimAssoc"))
				{
					acutPrintf(str);
					obj->upgradeOpen();						
					obj->erase();
					//移除永久反应器
					pDim->removePersistentReactor(persReactorId);
				}						
				//obj->close();					
			}	
		}
		//释放删除反应器的空字典
		pDim->releaseExtensionDictionary();
	}

  

转载于:https://www.cnblogs.com/edata/p/10731436.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值