void
ArxDbgAppEditorReactor::searchOneDictionary(AcDbDictionary* dict, AcDbObjectIdArray& objIds)
{
        // get an iterator over this dictionary
    AcDbDictionaryIterator* dictIter = dict->newIterator();
    ASSERT(dictIter != NULL);

        // walk dictionary and just collect all the entries that are of the
        // given type
    AcDbObject* obj;
    for (; !dictIter->done(); dictIter->next()) {
        if (acdbOpenAcDbObject(obj, dictIter->objectId(), AcDb::kForRead) == Acad::eOk) {
            if (obj->isKindOf(ArxDbgDbDictRecord::desc())) {
                objIds.append(obj->objectId());
            }
            else if (obj->isKindOf(AcDbDictionary::desc())) {
                searchOneDictionary(AcDbDictionary::cast(obj), objIds);
            }

            obj->close();
        }
    }
    delete dictIter;
    dict->close();
}
示例#2
0
void DrawCmd::DrawChimney( void )
{
    acutPrintf( _T( "\n绘制风筒测试..." ) );

    AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一个掘进工作面:" ) );
    if( objId.isNull() ) return;
    if( !ArxUtilHelper::IsEqualType( _T( "TTunnel" ), objId ) ) return;

    AcDbObjectIdArray objIds;
    DrawHelper::GetTagGEById2( objId, _T( "Chimney" ), objIds );
    if( !objIds.isEmpty() )
    {
        AfxMessageBox( _T( "该掘进工作面已设置了风筒!" ) );
        return;
    }

    AcGePoint3dArray pts;
    PolyLineJig jig;
    if( !jig.doJig( pts ) ) return;

    int len = pts.length();
    acutPrintf( _T( "\n点个数:%d" ), len );
    if( len < 2 ) return;

    Chimney* pChimney = new Chimney();
    pChimney->setRelatedGE( objId ); // 关联的图元必须是掘进工作面

    for( int i = 0; i < len; i++ ) pChimney->addControlPoint( pts[i] );

    // 初始化并提交到数据库
    if( !ArxUtilHelper::PostToModelSpace( pChimney ) ) delete pChimney;
}
示例#3
0
void DrawCmd::DrawLocalFan()
{
    AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一个掘进工作面:" ) );
    if( objId.isNull() ) return;
    if( !ArxUtilHelper::IsEqualType( _T( "TTunnel" ), objId ) ) return;

    AcDbObjectIdArray objIds;
    DrawHelper::GetTagGEById2( objId, _T( "LocalFan" ), objIds );
    if( !objIds.isEmpty() )
    {
        AfxMessageBox( _T( "该掘进工作面已设置了局部通风机!" ) );
        return;
    }

    AcGePoint3d pt;
    if( !ArxUtilHelper::PromptPt( _T( "\n请指定局扇的插入点坐标:" ), pt ) ) return;

    Fan* pFan = new LocalFan( pt, 0 ); // 目前假设局扇的角度为0(实际绘图中局扇是没有方向的)
    if( pFan == 0 ) return;

    pFan->setRelatedGE( objId ); // 关联巷道

    // 初始化并提交到数据库
    if( !ArxUtilHelper::PostToModelSpace( pFan ) ) delete pFan;
}
示例#4
0
	// - MfcArx.syj_mfc command (do not rename)
	static void MfcArxsyj_mfc(void)
	{
		// Add your code for command MfcArx.syj_mfc here
		ads_name ss;
		resbuf rb;
		AcDbObjectIdArray objIds = NULL;
		acedSSGet(NULL,NULL,NULL,NULL,ss);
		long len;
		//取得选择集的长度
		acedSSLength(ss,&len);
		//遍历选择集中的实体,将其打开并修改其颜色为红色
		for (int i =0;i<len;i++)
		{
			ads_name entres;
			AcDbObjectId objId;
			//取得选择集中实体的名称ads_name
			acedSSName(ss,i,entres);
			//取得实体的ObjectId
			acdbGetObjectId(objId,entres);
			objIds.append(objId);
		}
		acedSSFree(ss);
		CDetailShow ds(objIds,NULL,NULL);
		ds.DoModal();

	}
示例#5
0
 bool ArxEntityHelper::SelectEntities( const AcDbObjectIdArray& objIds )
{
	//acedSSSetFirst(NULL, NULL);

	if( objIds.isEmpty() ) return false;

	ads_name ss;
	//创建一个空的选择集
	if(RTNORM != acedSSAdd( NULL, NULL, ss )) return false;
	bool ret = true;
	for(int i=0;i<objIds.length();i++)
	{
		ads_name ename;
		if( Acad::eOk != acdbGetAdsName( ename, objIds[i] ) ) 
		{ 
			ret = false;;
			break;
		}
		if( RTNORM != acedSSAdd( ename, ss, ss ) )  // 添加到选择集
		{
			ret = false;;
			break;
		}
	}

	if(ret)
	{
		acedSSSetFirst( ss, NULL ); // 高亮选中
	}
	acedSSFree( ss );           // 释放选择集

	return ret;
}
void frgExtractTopologicalEntsFromLinesAlgm::_extract_vertices_from_lines(std::vector<Vertex2dsOnSegment2d> &seg_pnts_pairs,
	const AcDbObjectIdArray &ids)
{
	AcDbEntity *entity = NULL;
	acedSetStatusBarProgressMeter(_T("正在提取每根线段上的节点..."), 0, ids.length());
	for (int i = 0; i < ids.length(); i++)
	{
		acdbOpenAcDbEntity(entity, ids[i], AcDb::kForRead);
		if (entity == NULL)
			continue;

		if (entity->isA() != AcDbLine::desc())
		{
			entity->close();
			continue;
		}
		AcDbLine *line = (AcDbLine *)entity;

		Vertex2dsOnSegment2d stru;
		stru.seg.set(AcGePoint2d(line->startPoint().x, line->startPoint().y),
			AcGePoint2d(line->endPoint().x, line->endPoint().y));
		entity->close();

		_extract_from_seg(stru);
		seg_pnts_pairs.push_back(stru);
		acedSetStatusBarProgressMeterPos(i);
	}
	acedRestoreStatusBar();
}
示例#7
0
void DrawHelper::SwitchDraw( const CString& geType, const CString& drawName )
{
    // 设置当前可视化效果
    if( !SetCurDraw( geType, drawName ) ) return;

    // 更新所有指定类型的图元
    AcDbObjectIdArray objIds;
    ArxDataTool::GetEntsByType( geType, objIds, false );
    if( objIds.isEmpty() ) return; // dwg图形中没有任何MineGE类型图元

    // 将所有geType类型图元的绘制效果更新
    AcTransaction* pTrans = actrTransactionManager->startTransaction();
    if( pTrans == 0 ) return;

    int len = objIds.length();
    for( int i = 0; i < len; i++ )
    {
        AcDbObject* pObj;
        if( Acad::eOk != pTrans->getObject( pObj, objIds.at( i ), AcDb::kForWrite ) ) continue;

        MineGE* pGE = MineGE::cast( pObj );
        if( pGE == 0 ) continue;

        pGE->updateDraw();             // 更细可视化效果指针
        //pGE->recordGraphicsModified(true);  // 更新图形
    }

    actrTransactionManager->endTransaction();

    AcRxClass* pClass = AcRxClass::cast( acrxClassDictionary->at( geType ) );
    if( pClass != 0 && pClass->isDerivedFrom( LinkedGE::desc() ) )
    {
        UpdateLinkedGE( objIds );
    }
}
void frgExtractTopologicalEntsFromLinesAlgm::_extract_from_seg(Vertex2dsOnSegment2d &stru)
{
	// - 获取相关的线段(相交、重合)
	AcDbObjectIdArray ids;
	_search_related_segs(ids, stru.seg);

	// - 分为两类进行处理:相交和重叠
	// -- 增加起点和终点
	rlVertex2d *v = NULL;
	stru.vertex2ds.insert(std::make_pair(0.0, v));
	stru.vertex2ds.insert(std::make_pair(1.0, v));

	// -- 处理每一个线段
	AcDbEntity *entity = NULL;
	for (int i = 0; i < ids.length(); i++)
	{
		acdbOpenAcDbEntity(entity, ids[i], AcDb::kForRead);
		if (entity == NULL)
			continue;

		if (entity->isA() != AcDbLine::desc())
		{
			entity->close();
			continue;
		}
		AcDbLine *_line = (AcDbLine *)entity;

		AcGeLineSeg2d _seg(AcGePoint2d(_line->startPoint().x, _line->startPoint().y),
			AcGePoint2d(_line->endPoint().x, _line->endPoint().y));
		_line->close();

		_extract_vertices(stru, _seg);
	}
}
void OnlyOneSelectFilter::ssgetAddFilter (
    int ssgetFlags,
    AcEdSelectionSetService& service,
    const AcDbObjectIdArray& selectionSet,
    const AcDbObjectIdArray& subSelectionSet
)
{
    //acutPrintf(_T("\n ssgetAddFilter==> select set: %d"), selectionSet.length());
    //acutPrintf(_T("\n ssgetAddFilter==> subselect set: %d\n"), subSelectionSet.length());

    //AcEdSSGetFilter::ssgetAddFilter (ssgetFlags, service, selectionSet, subSelectionSet) ;
    if( selectionSet.length() == 0 )
    {
        if( subSelectionSet.length() > 1 )
        {
            int len = subSelectionSet.length();
            for( int i = 0; i < len - 1; i++ )
            {
                Acad::ErrorStatus es = service.remove( i );
            }
        }
    }
    else
    {
        int len = subSelectionSet.length();
        for( int i = 0; i < len; i++ )
        {
            Acad::ErrorStatus es = service.remove( i );
        }
    }
}
void
ArxDbgUiTdcObjReactorsBase::OnObjAttach() 
{
    CString newHandle, str;
    AcDbObjectId objId;

        // see if specified handle is valid
    m_ebHandle.GetWindowText(newHandle);
    if (ArxDbgUtils::handleStrToObjId(acdbHostApplicationServices()->workingDatabase(),
					newHandle, objId, false) != Acad::eOk) {
        str.Format(_T("\"%s\" is not a valid handle."), newHandle);
        ArxDbgUtils::alertBox(str);
        m_ebHandle.SetSel(0, -1); // reset to select all
        m_ebHandle.SetFocus();
        return;
    }

	AcDbObjectIdArray newObjIds;
	newObjIds.append(objId);

	attachObjReactors(newObjIds);

    m_ebHandle.SetWindowText(_T(""));    // reset edit box to be empty for new handle

	displayObjList();
}
示例#11
0
AcDbObjectId DoubleLine::draw()
{
    //计算始端的2个坐标
    AcGePoint3d m_leftStartPt, m_leftEndPt;
    AcGePoint3d m_rightStartPt, m_rightEndPt;
    caclStartPoint( m_leftStartPt, m_rightStartPt );
    //计算末端的2个坐标
    caclEndPoint( m_leftEndPt, m_rightEndPt );
    //绘制2条直线
    AcDbObjectId line1 = ArxDrawHelper::DrawLine( m_leftStartPt, m_leftEndPt );
    AcDbObjectId line2 = ArxDrawHelper::DrawLine( m_rightStartPt, m_rightEndPt );

    //构造group
    AcDbObjectIdArray objIds;
    objIds.append( line1 );
    objIds.append( line2 );
    //构造临时的组名
    CString name;
    name.Format( _T( "巷道%d" ), count++ );
    AcDbObjectId groupId = ArxGroupHelper::CreateGroup( name, objIds );
    if( !groupId.isNull() )
    {
        ArxGroupHelper::ConvertToAnonymousGroup( groupId );
    }
    return groupId;
}
示例#12
0
// 从图元的扩展词典中查找数据对象
static void GetDataObjectFromExtDict( AcDbObjectIdArray& dbObjIds )
{
    AcDbObjectIdArray allObjIds;
    ArxDataTool::GetEntsByType( _T( "MineGE" ), allObjIds, true );

    // 判断是否数据对象DataObject
    // 且类型名称==type
    if( allObjIds.isEmpty() ) return;

    AcTransaction* pTrans = actrTransactionManager->startTransaction();
    if( pTrans == 0 ) return;

    int len = allObjIds.length();
    for( int i = 0; i < len; i++ )
    {
        AcDbObject* pObj;
        if( Acad::eOk != pTrans->getObject( pObj, allObjIds[i], AcDb::kForRead ) ) continue;

        MineGE* pGE = MineGE::cast( pObj );
        if( pGE == 0 ) continue;

        AcDbObjectId dbObjId = pGE->getDataObject();
        if( !dbObjId.isNull() )
        {
            dbObjIds.append( dbObjId );
        }
    }
    actrTransactionManager->endTransaction();
}
示例#13
0
	static void YCROYCRO_CG_AddRegion() 
	{
		ads_name ss; 
		int rt = acedSSGet(NULL, NULL, NULL, NULL, ss);
		AcDbObjectIdArray objIds; 
		if (rt == RTNORM) 
		{ 
			long length; 
			acedSSLength(ss, &length);
			for (int i = 0; i < length; i++) 
			{ 
				ads_name ent; 
				acedSSName(ss, i, ent); 
				AcDbObjectId objId; 
				acdbGetObjectId(objId, ent); 
				objIds.append(objId); 
			} 
		} 
		acedSSFree(ss);
		AcDbObjectIdArray regionIds;
		regionIds = CCreateEnt::CreateRegion(objIds); 
		int number = regionIds.length(); 
		if (number > 0) 
		{ 
			acutPrintf(_T("\n已经创建%d个面域!"), number); 
		} 
		else 
		{ 
			acutPrintf(_T("\n创建0个面域!")); 
		} 
	}
void
ArxDbgUiTdcPersistentReactors::getAttachedEntities(AcDbObjectIdArray& objIds)
{
	AcDbVoidPtrArray dbPtrs;
	ArxDbgUtils::getAllDatabases(dbPtrs);

	AcDbObjectId prId;
	ArxDbgPersistentEntReactor* peReactor;
	Acad::ErrorStatus es;
	AcDbObjectIdArray tmpIds;

	int len = dbPtrs.length();
	for (int i=0; i<len; i++) {
		prId = getPersistentEntReactor(static_cast<AcDbDatabase*>(dbPtrs[i]), false);

		es = acdbOpenObject(peReactor, prId, AcDb::kForRead);
		if (es == Acad::eOk) {
			tmpIds.setLogicalLength(0);	// reusing array for each database

			peReactor->getAttachedToObjs(tmpIds);
			peReactor->close();

			objIds.append(tmpIds);
		}
	}
}
示例#15
0
void DrawHelper::ConfigDraw( const CString& geType, const CString& drawName )
{
    MineGEDraw* pDraw = MineGEDrawSystem::GetInstance()->getGEDraw( geType, drawName );
    if( pDraw == 0 ) return; // 该绘制效果不存在

    pDraw->configExtraParams(); // 配置附加参数

    AcDbObjectIdArray objIds;
    ArxDataTool::GetEntsByType( geType, objIds, false );
    if( objIds.isEmpty() ) return; // dwg图形中没有任何geType类型图元

    AcTransaction* pTrans = actrTransactionManager->startTransaction();
    if( pTrans == 0 ) return;

    int len = objIds.length();
    for( int i = 0; i < len; i++ )
    {
        AcDbObject* pObj;
        if( Acad::eOk != pTrans->getObject( pObj, objIds.at( i ), AcDb::kForWrite ) ) continue;

        MineGE* pGE = MineGE::cast( pObj );
        if( pGE == 0 ) continue;

        pGE->configDraw( pDraw->isA()->name() ); // 更新extra param
        pGE->recordGraphicsModified( true );   // 更新图形
    }
    actrTransactionManager->endTransaction();

    AcRxClass* pClass = AcRxClass::cast( acrxClassDictionary->at( geType ) );
    if( pClass != 0 && pClass->isDerivedFrom( LinkedGE::desc() ) )
    {
        UpdateLinkedGE( objIds );
    }
}
示例#16
0
int getAllSymbolRecordsIds(AcRxClass* pTableClass, AcDbObjectIdArray & idaAll)
{
	CLogger::Print(_T("*Call: getAllSymbolRecordsIds()"));
	Acad::ErrorStatus es;
	idaAll.setLogicalLength(0);

	AcDbDatabase* pDb = acdbHostApplicationServices()->workingDatabase();
	AcDbSymbolTable* pSymbolTable = NULL;

	if (AcRx::kEqual == pTableClass->comparedTo(AcDbBlockTable::desc())) {
		CLogger::Print(_T("> This is BlockTable!"));
		es = pDb->getBlockTable(pSymbolTable, AcDb::kForRead);
	}
	else if (AcRx::kEqual == pTableClass->comparedTo(AcDbLayerTable::desc())) {
		CLogger::Print(_T("> This is LayerTable!"));
		es = pDb->getLayerTable(pSymbolTable, AcDb::kForRead);
	}
	else if (AcRx::kEqual == pTableClass->comparedTo(AcDbLinetypeTable::desc())) {
		CLogger::Print(_T("> This is LinetypeTable!"));
		es = pDb->getLinetypeTable(pSymbolTable, AcDb::kForRead);
	}
	else if (AcRx::kEqual == pTableClass->comparedTo(AcDbTextStyleTable::desc())) {
		CLogger::Print(_T("> This is TextStyleTable!"));
		es = pDb->getTextStyleTable(pSymbolTable, AcDb::kForRead);
	}
	else {
		CLogger::Print(_T("*Exit: getAllSymbolRecordsIds() - This kind of SymbolTable is not supported!"));
		return -1;
	}

	if (Acad::eOk != es) {
		CLogger::Print(_T("*Exit: getAllSymbolRecordsIds() -  Fail to get SymbolTable!"));
		return -1;
	}
	
	//------------
	// Get the SymbolTable's iterator.
	AcDbSymbolTableIterator* pSymbolTableIter = NULL;
	es = pSymbolTable->newIterator(pSymbolTableIter);
	pSymbolTable->close();
	if (Acad::eOk != es) {
		CLogger::Print(_T("*Exit: getAllSymbolRecordsIds() - Fail to get the SymbolTable's iterator!"));
		return -1;
	}

	//------------
	// Steps through the SymbolTable's records. 
	// Then get the SymbolTableRecord's ObjectID.
	for (; !pSymbolTableIter->done(); pSymbolTableIter->step()) {
		AcDbObjectId idObj = AcDbObjectId::kNull;
		if (Acad::eOk == pSymbolTableIter->getRecordId(idObj))
			idaAll.append(idObj);
	}

	delete pSymbolTableIter;
	CLogger::Print(_T("*Exit: getAllSymbolRecordsIds() - Count: %02d"), idaAll.length());
	return idaAll.length();
}
static void FindWindStationHosts( const AcDbObjectIdArray& objIds, AcDbObjectIdArray& hosts )
{
    FWSHelper fws;
    int len = objIds.length();
    for( int i = 0; i < len; i++ )
    {
        hosts.append( fws.doFWS( objIds[i] ) );
    }
}
示例#18
0
void DrawHelper::GetTagGEById2( const AcDbObjectId& objId, const CString& geType, AcDbObjectIdArray& objIds )
{
    // 查找图元ObjId关联的所有标签
    AcDbObjectIdArray allObjIds;
    DrawHelper::GetAllTagGEById( objId, allObjIds );
    if( allObjIds.isEmpty() ) return;

    // 筛选出类型为geType的tag
    GetTagGEById2_Helper( geType, allObjIds, objIds );
}
示例#19
0
void DrawCmd::DrawFanTag()
{
	AcDbObjectIdArray fanIds;
	DrawHelper::FindMineGEs(_T("LocalFan"),fanIds);
	int len = fanIds.length();
	for (int i = 0; i < len; i++)
	{
		FanTagGEDrawed(fanIds[i]);
	}
}
示例#20
0
文件: UIHelper.cpp 项目: kanbang/TIDS
void UIHelper::DisplayDataByDoubleClick()
{
    //acutPrintf(_T("\n双击自定义..."));
    AcDbObjectIdArray objIds;
    ArxUtilHelper::GetPickSetEntity( objIds );
    if( objIds.length() != 1 ) return;

    // 显示属性对话框
    PropertyDataDlgHelper::DisplayPropertyDataDlg( objIds[0] );
}
示例#21
0
void ArxEntityHelper::EraseObjects2( const AcDbObjectIdArray& objIds, Adesk::Boolean erasing )
{
    if( objIds.isEmpty() ) return;

    int len = objIds.length();
    for( int i = 0; i < len; i++ )
    {
        EraseObject2( objIds[i], erasing );
    }
}
Acad::ErrorStatus
ArxDbgUtils::cloneObjects(AcDbDatabase* db, const AcDbObjectId& entToClone,
                        const AcDbObjectId& ownerBlockId, bool debugSpeak)
{
	ASSERT(db != NULL);

    AcDbObjectIdArray objIdList;
    objIdList.append(entToClone);

    return cloneObjects(db, objIdList, ownerBlockId, debugSpeak);
}
示例#23
0
// 查找采空区的其它边
void FindGasBoundary( const AcDbObjectIdArray& objIds,
                      const AcDbVoidPtrArray& lines,
                      AcGePoint3dArray& spts,
                      AcGePoint3dArray& epts,
                      AcGeDoubleArray& dirs,
                      AcDbIntArray& gas_types,
                      AcDbObjectIdArray& gas_objIds )
{
    // 查找所有的采空区
    AcDbObjectIdArray goaf_objIds;
    FindAllGoafs( goaf_objIds );

    // 将采空区多边形转换成一个1维数组
    AcGePoint3dArray polygons;
    AcDbIntArray polygon_counts;
    BuildGoafPolygonArray( goaf_objIds, polygons, polygon_counts );

    // 标记采空区分支是否与其它采空区有共线边
    AcDbIntArray colinearEdges;
    FindPolygonColinearEdges( polygons, polygon_counts, colinearEdges );

    // 查找所有的工作面
    AcDbVoidPtrArray ws_lines;
    FilterLines( lines, ws_lines, true );

    // 划分采空区多边形(工作面、两帮、开切眼)
    AcDbIntArray parTypes;
    PartitionGoafPolygons( ws_lines, polygons, polygon_counts, parTypes );

    assert( parTypes.length() == polygons.length() );

    // 工作面需要特殊处理
    AcDbIntArray gas_linePos;
    AdjustGoafPolygon(
        lines, polygons, polygon_counts,
        colinearEdges, parTypes,
        spts, epts, dirs,
        gas_types, gas_linePos );

    assert( gas_types.length() == gas_linePos.length() );

    for( int i = 0; i < gas_linePos.length(); i++ )
    {
        int pos = gas_linePos[i];
        if( pos != -1 )
        {
            gas_objIds.append( objIds[pos] );
        }
        else
        {
            gas_objIds.append( AcDbObjectId::kNull );
        }
    }
}
示例#24
0
void DrawCmd::DrawEffectRanGE()
{
	AcDbObjectIdArray ttunels;
	DrawHelper::FindMineGEs(_T("TTunnel"),ttunels);
	int len = ttunels.length();
	if(ttunels.isEmpty()) return;
	for (int i = 0; i < len; i++)
	{
		EffectRanDrawed(ttunels[i]);
	}

}
示例#25
0
void DrawCmd::DrawQTagGE()
{
	AcDbObjectIdArray chims;
	DrawHelper::FindMineGEs(_T("Chimney"),chims);
	int len = chims.length();
	//acutPrintf(_T("\n风筒数:%d"),len);
	if(chims.isEmpty()) return;
	for (int i = 0; i < len; i++)
	{
		QTagGEDrawed(chims[i]);
	}

}
示例#26
0
static AcDbObjectId GetContourInfoOnLayer( const CString& layer )
{
    AcDbObjectIdArray allObjIds;
    LayerHelper::GetAllEntitiesOnLayer( layer, allObjIds );

    AcDbObjectIdArray objIds;
    ArxDataTool::FilterEntsByType( _T( "ContourInfo" ), allObjIds, objIds );

    if( objIds.isEmpty() )
        return AcDbObjectId::kNull;
    else
        return objIds[0];
}
示例#27
0
static void EffectRanDrawed(AcDbObjectId ttunel)
{
	AcTransaction *pTrans = actrTransactionManager->startTransaction();
	if ( 0 == pTrans ) return;
	AcDbObject *pObj;
	if (Acad::eOk != pTrans->getObject(pObj,ttunel,AcDb::kForRead)) return;
	TTunnel *pTTunnel = TTunnel::cast(pObj);
	if ( 0 == pTTunnel)
	{
		actrTransactionManager->abortTransaction();
		return;
	}
	AcGePoint3d spt,ept;
	pTTunnel->getSEPoint(spt,ept);
	double angle = pTTunnel->getAngle();
	actrTransactionManager->endTransaction();

	AcDbObjectIdArray eTags;
	DrawHelper::GetTagGEById2( ttunel, _T( "EffectRanTagGE" ), eTags );
	if (!eTags.isEmpty())
	{
		ArxEntityHelper::EraseObjects( eTags, true );
	}

	AcGeVector3d v = ept - spt;
	double diatance = v.length();
	CString area,way;
	if(!DataHelper::GetPropertyData(ttunel,_T("断面面积"),area)) return;
	if(!DataHelper::GetPropertyData(ttunel,_T("通风方法"),way)) return;

	double minDistan,maxDistan;
	if(way.IsEmpty()) return;
	if(area.IsEmpty()) return;

	if (_T("压入式") == way || _T("长压短抽") == way)
	{
		minDistan = 4*sqrtf(_tstof(area));
		maxDistan = 5*sqrtf(_tstof(area));
	}

	else
	{
		minDistan = 0;
		maxDistan = 1.5*sqrtf(_tstof(area));
	}
	EffectRanTagGE *pTag = new EffectRanTagGE(ept,angle,minDistan,maxDistan,diatance*0.1);
	if (0 == pTag) return;

	pTag->setRelatedGE(ttunel);
	if( !ArxUtilHelper::PostToModelSpace( pTag ) ) delete pTag;
}
示例#28
0
void ArxEntityHelper::TransformEntities2( const AcDbObjectIdArray& objIds, const AcGeMatrix3d& xform )
{
    if( objIds.isEmpty() ) return;

	int len = objIds.length();
    for( int i = 0; i < len; i++ )
    {
		AcDbEntity* pEnt;
		if( Acad::eOk == acdbOpenAcDbEntity( pEnt, objIds[i], AcDb::kForWrite ) )
		{
			pEnt->transformBy( xform );
			pEnt->close();
		}
    }
}
示例#29
0
static void UpdateEdge( const AcDbObjectIdArray& objIds )
{
    AcTransaction* pTrans = actrTransactionManager->startTransaction();
    if( pTrans == 0 ) return;

    int n = objIds.length();
    for( int i = 0; i < n; i++ )
    {
        AcDbObjectId objId = objIds.at( i );

        LinkedGE* pEdge = OpenEdge2( pTrans, objId, AcDb::kForWrite );
        pEdge->recordGraphicsModified( true ); // 标签图形已经修改,需要更新图形
    }
    actrTransactionManager->endTransaction();
}
void asdktest3 () {
    //----- Create a line and a circle (memory only)
    AcDbLine *pLine =new AcDbLine (AcGePoint3d (), AcGePoint3d (100, 100, -100)) ;
    AcDbCircle *pCircle =new AcDbCircle (AcGePoint3d (50, 50, 0), AcGeVector3d (0, 0, 1) , 25.0) ;

    //----- Create a region from the circle
    AcDbVoidPtrArray arr1, arr2 ;
    arr1.append (pCircle) ;
    AcDbRegion::createFromCurves (arr1, arr2) ;
    AcDbRegion *pRegion =(AcDbRegion *)arr2.at (0) ;
    delete pCircle ;

    //----- Add the line and the region objects to the collector
    //----- NB: Remember those object are memory objects only
    AsdkHlrCollector collector ;
    collector.setDeleteState (true) ;
    collector.addEntity (pLine) ;
    collector.addEntity (pRegion) ;

    //----- Process hidden line removal
    AsdkHlrEngine hlr (AcGePoint3d (50, 50,0), AcGeVector3d (0, 0, 1), kEntity | kBlock | kShowAll | kProject | kHonorInternals) ;
    hlr.run (collector) ;

    //----- To easily see the result, we do append resulting entities to the current database
    //----- and use the color convention used in command 'TEST1'
    int n =collector.mOutputData.logicalLength () ;
    for ( int i =0 ; i < n ; i++ ) {
        AsdkHlrData *p =collector.mOutputData [i] ;

        AcDbEntity *pEnt =p->getResultEntity () ;
        AsdkHlrData::Visibility vis =p->getVisibility () ;
        if ( vis == AsdkHlrData::kVisible )
            pEnt->setColorIndex (1) ;
        else
            pEnt->setColorIndex (5) ;
        AcDbObjectId id ;
        if ( postToDatabase (NULL, pEnt, id) != Acad::eOk ) {
            acutPrintf (_T("Failed to add entity to current space.\n")) ;
            break ;
        }

        //----- Entity originator path
        AcDbObjectIdArray ids =p->getObjectIds () ;
        if ( ids.logicalLength () > 0 ) {
            acutPrintf (ACRX_T("\n%ld, "), pEnt->objectId ().asOldId ()) ;
            for ( int j =0 ; j < ids.logicalLength () ; j++ ) {
                acutPrintf (ACRX_T("%ld, "), ids.at (j).asOldId ()) ;
            }
        }

        pEnt->close () ;
    }
}