当前位置: 首页>>代码示例>>C++>>正文


C++ AcDbLayerTableRecord类代码示例

本文整理汇总了C++中AcDbLayerTableRecord的典型用法代码示例。如果您正苦于以下问题:C++ AcDbLayerTableRecord类的具体用法?C++ AcDbLayerTableRecord怎么用?C++ AcDbLayerTableRecord使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AcDbLayerTableRecord类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: acdbCurDwg

void Additional_Class::SetLayerIsOff( CString strLayerName)
{
	AcDbLayerTable *pLayTbl = NULL; 
	acdbCurDwg()->getLayerTable(pLayTbl, AcDb::kForWrite); 
	if(!pLayTbl->has(strLayerName)) 
	{ 
		pLayTbl->close(); //该图层不存在 
		return; 
	} 

	AcDbLayerTableRecord *pLayTblRec = NULL; 
	AcDbObjectId objId; 
	pLayTbl->getAt(strLayerName, pLayTblRec, AcDb::kForWrite); 
	pLayTbl->close(); 

	//pLayTblRec->isInUse();
	
	if (pLayTblRec==NULL) 
	{ 
		return; 
	} 
	bool tempBool = pLayTblRec->isOff();
	if (tempBool == false)
	{
		pLayTblRec->setIsOff(true); 
	}
	else
	{
		pLayTblRec->setIsOff(false);
	}
	pLayTblRec->close(); 
	return; 
}
开发者ID:TobeGodman,项目名称:AutoTrader,代码行数:33,代码来源:Additional_Class.cpp

示例2: ModifyLayerProp

void ModifyLayerProp()
{
	CString strLayerName(_T("NewLayer"));

	AcDbLayerTable* pLayerTbl = NULL;
	acdbHostApplicationServices()->workingDatabase()->getLayerTable(pLayerTbl, AcDb::kForRead);

	if (!pLayerTbl->has(strLayerName))
	{
		pLayerTbl->close();
		acutPrintf(_T("\nNo existed layer:\"%s\"."), strLayerName);
		return;
	}

	Acad::ErrorStatus es;
	AcDbLayerTableRecord* pLayerTblRcd = NULL;
	pLayerTbl->getAt(strLayerName, pLayerTblRcd, AcDb::kForWrite);

	AcCmColor oldColor = pLayerTblRcd->color();
	int nCurColor = oldColor.colorIndex();
	int nNewColor = oldColor.colorIndex();

	if (acedSetColorDialog(nNewColor, Adesk::kFalse, nCurColor))
	{
		AcCmColor color;
		color.setColorIndex(nNewColor);
		pLayerTblRcd->setColor(color);
		acutPrintf(_T("\nThe color of  layer:\"%s\" has modified!"), strLayerName);
	}

	pLayerTblRcd->close();
	pLayerTbl->close();
}
开发者ID:kevinzhwl,项目名称:ZRXSDKMod,代码行数:33,代码来源:LayerSample.cpp

示例3: acdbOpenAcDbObject

bool
ArxDbgUtils::isOnLockedLayer(AcDbEntity* ent, bool printMsg)
{
    AcDbObject* obj;
    AcDbLayerTableRecord* layer;
    bool isLocked = false;
    Acad::ErrorStatus es;

    es = acdbOpenAcDbObject(obj, ent->layerId(), AcDb::kForRead);
    if (es == Acad::eOk) {
        layer = AcDbLayerTableRecord::cast(obj);
        if (layer)
            isLocked = layer->isLocked();
        else {
            ASSERT(0);
        }
        obj->close();
    }
    else {
        ASSERT(0);
        ArxDbgUtils::rxErrorMsg(es);
    }

    if (isLocked && printMsg) {
        acutPrintf(_T("\nSelected entity is on a locked layer."));
    }

    return isLocked;
}
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:29,代码来源:ArxDbgUtilsSymTbl.cpp

示例4: acdbCurDwg

//把一层设置为OFF or ON
void CArxHelper::SetOneLayer(const TCHAR *name,int flag,bool YN)
	//flag 1:isoff 2:isfrozen 3:islocked
{
	AcDbLayerTable *pLayerTable;
	acdbCurDwg()->getLayerTable(pLayerTable,AcDb::kForRead);

	if(!pLayerTable->has(name))
	{
		pLayerTable->close();
		return;
	}

	AcDbObjectId id;
	pLayerTable->getAt(name,id);
	AcDbLayerTableRecord *pLayerTableRecord;
	acdbOpenObject(pLayerTableRecord,id,AcDb::kForWrite);

	switch(flag)
	{
	case 1:
		pLayerTableRecord->setIsOff(YN);
		break;
	case 2:
		pLayerTableRecord->setIsFrozen(YN);
		break;
	case 3:
		pLayerTableRecord->setIsLocked(YN);
		break;
	}

	pLayerTableRecord->close();
	pLayerTable->close();
}
开发者ID:ninuo,项目名称:ArxWorkspace,代码行数:34,代码来源:ArxHelper2.cpp

示例5: acdbHostApplicationServices

bool Additional_Class::FindLayer( CString LaylerName )
{
	int n = 0;//判断是否找到图层
	//////////////////////////////////////////////////////////////////////////
	AcDbLayerTable *pLayerTbl;
	acdbHostApplicationServices()->workingDatabase()
		->getSymbolTable(pLayerTbl, AcDb::kForWrite);

	// 建立图层遍历器
	AcDbLayerTableIterator *pLayerIterator;
	pLayerTbl->newIterator(pLayerIterator);
	//
	AcDbLayerTableRecord *pLayerTableRcd;
	ACHAR *pLtName;
	ACHAR *pLtNameTT;
	CString pLtNameStr;
	for (; !pLayerIterator->done(); pLayerIterator->step()) 
	{
		pLayerIterator->getRecord(pLayerTableRcd, AcDb::kForWrite);
		pLayerTableRcd->getName(pLtName);
		pLayerTableRcd->close();
		pLtNameStr = pLtName;
		if (pLtNameStr == LaylerName)
		{
			return true;
		}
		else
		{
			free(pLtName);
		}
	}
	return false;
}
开发者ID:TobeGodman,项目名称:AutoTrader,代码行数:33,代码来源:Additional_Class.cpp

示例6: unlock

bool CLayerState::unlock(void)
{
	AcDbLayerTableRecord* pLayer = NULL;
	if (acdbOpenObject(pLayer, m_idLayer, AcDb::kForWrite) != Acad::eOk)
		return false;

	pLayer->setIsLocked(false);
	pLayer->close();
	return true;
}
开发者ID:vuonganh1993,项目名称:arxlss,代码行数:10,代码来源:LayerState.cpp

示例7: set

bool CLayerState::set(void)
{
	AcDbLayerTableRecord* pLayer = NULL;
	if (Acad::eOk != acdbOpenObject(pLayer, m_idLayer, AcDb::kForWrite))
		return false;

	pLayer->setIsOff(m_bOff);
	pLayer->setIsFrozen(m_bFrozen);
	pLayer->setIsLocked(m_bLocked);
	pLayer->close();
	return true;
}
开发者ID:vuonganh1993,项目名称:arxlss,代码行数:12,代码来源:LayerState.cpp

示例8:

CLayerState::CLayerState(const AcDbObjectId& idLayer)
{
	m_idLayer = idLayer;
	AcDbLayerTableRecord* pLayer = NULL;
	if (acdbOpenObject(pLayer, m_idLayer, AcDb::kForRead) == Acad::eOk) {
		m_bOff = pLayer->isOff();
		m_bFrozen = pLayer->isFrozen();
		m_bLocked = pLayer->isLocked();
		pLayer->close();
	} else  {
		m_bOff = false;
		m_bFrozen = false;
		m_bLocked = false;
	}
}
开发者ID:vuonganh1993,项目名称:arxlss,代码行数:15,代码来源:LayerState.cpp

示例9: acdbHostApplicationServices

void
AecUiPrEntitySet::getLockedLayers()
{
    m_lockedLayerCache.setLogicalLength(0);
    m_lockedLayerNames.RemoveAll();

    if (m_filterLockedLayers == Adesk::kFalse)
        return;

    AcDbLayerTableRecord* layer;
    const TCHAR* tmpName;

    AcDbLayerTable* layTbl;
    Acad::ErrorStatus es = acdbHostApplicationServices()->workingDatabase()->getSymbolTable(layTbl, AcDb::kForRead);
    if (es == Acad::eOk) {
        AcDbLayerTableIterator* tblIter;
        if (layTbl->newIterator(tblIter) == Acad::eOk) {
            for (; !tblIter->done(); tblIter->step()) {
                es = tblIter->getRecord(layer, AcDb::kForRead);
                if (es == Acad::eOk) {
                    if (layer->isLocked()) {
                        m_lockedLayerCache.append(layer->objectId());

                        es = layer->getName(tmpName);
                        if (es == Acad::eOk) {
                            m_lockedLayerNames.Add(tmpName);
                        }
                        else {
                            AEC_ASSERT(0);
                            m_lockedLayerNames.Add(_DNT(_T("")));   // have to keep balanced
                        }
                    }

                    layer->close();
                }
            }
            delete tblIter;
        }
        else {
            AEC_ASSERT(0);
        }

        layTbl->close();
    }
}
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:45,代码来源:ArxDbgUiPrEntitySet.cpp

示例10: addLayer

// This function creates a new AcDbLayerTableRecord, fills
// it in, and adds it to the layer table
// 
// THE FOLLOWING CODE APPEARS IN THE SDK DOCUMENT.
//
void
addLayer()
{
    AcDbLayerTable *pLayerTbl;
    acdbHostApplicationServices()->workingDatabase()
        ->getSymbolTable(pLayerTbl, AcDb::kForWrite);

    if (!pLayerTbl->has(_T("ASDK_TESTLAYER"))) {
        AcDbLayerTableRecord *pLayerTblRcd
            = new AcDbLayerTableRecord;
        pLayerTblRcd->setName(_T("ASDK_TESTLAYER"));
        pLayerTblRcd->setIsFrozen(0);// layer to THAWED
        pLayerTblRcd->setIsOff(0);   // layer to ON
        pLayerTblRcd->setVPDFLT(0);  // viewport default
        pLayerTblRcd->setIsLocked(0);// un-locked

        AcCmColor color;
        color.setColorIndex(1); // set color to red
        pLayerTblRcd->setColor(color);

        // For linetype, we need to provide the object ID of
        // the linetype record for the linetype we want to
        // use.  First, we need to get the object ID.
	//
        AcDbLinetypeTable *pLinetypeTbl;
        AcDbObjectId ltId;
        acdbHostApplicationServices()->workingDatabase()
            ->getSymbolTable(pLinetypeTbl, AcDb::kForRead);
        if ((pLinetypeTbl->getAt(_T("DASHED"), ltId))
            != Acad::eOk)
        {
            acutPrintf(_T("\nUnable to find DASHED")
                _T(" linetype. Using CONTINUOUS"));
            
            // CONTINUOUS is in every drawing, so use it.
            //
            pLinetypeTbl->getAt(_T("CONTINUOUS"), ltId);
        }
        pLinetypeTbl->close();

        pLayerTblRcd->setLinetypeObjectId(ltId);
        pLayerTbl->add(pLayerTblRcd);
        pLayerTblRcd->close();
        pLayerTbl->close();
    } else {
        pLayerTbl->close();
        acutPrintf(_T("\nlayer already exists"));
    }
}
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:54,代码来源:tablerec.cpp

示例11: ASSERT

Acad::ErrorStatus
ArxDbgUtils::addNewLayer(LPCTSTR layerName, AcDbDatabase* db)
{
	ASSERT(db != NULL);

        // if layer already exists, then just return
    AcDbLayerTable* layTbl;
	Acad::ErrorStatus es = db->getSymbolTable(layTbl, AcDb::kForRead);
	if (es != Acad::eOk)
		return es;

    if (layTbl->has(layerName)) {
        layTbl->close();
        return Acad::eOk;
    }
        // upgrade to write
    es = layTbl->upgradeOpen();
    if (es != Acad::eOk) {
        ASSERT(0);
        layTbl->close();
        return es;
    }
        // make sure the name gets set ok
    AcDbLayerTableRecord* newRec = new AcDbLayerTableRecord;
    es = newRec->setName(layerName);
    if (es != Acad::eOk) {
        delete newRec;
        layTbl->close();
        return Acad::eInvalidInput;
    }
        // look up value for default linetype CONTINUOUS,
        // AcDbLayerTableRecord doesn't set this automatically (at least it didn't in Sedona)
    newRec->setLinetypeObjectId(db->continuousLinetype());

    es = layTbl->add(newRec);
    if (es != Acad::eOk)
        delete newRec;
    else
        newRec->close();

    layTbl->close();
    return es;
}
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:43,代码来源:ArxDbgUtilsSymTbl.cpp

示例12: ShowLayer

void CLayerTreeDlg::ShowLayer(HTREEITEM hItem, BOOL bShow)
{
	CString sLayerName = m_tree.GetItemText(hItem);

	HTREEITEM hChild = m_tree.GetNextItem(hItem,TVGN_CHILD);

	// 只有树叶才有对应的图层
	if (hChild == NULL)
	{
		ShowLayer(sLayerName, bShow);
		//如果是面层,还要把它的填充图层打开
		CString sHatchLayer;
		sHatchLayer.Format("%s_填充",sLayerName);
		bool hasHatch = false;
		acDocManager->lockDocument(acDocManager->curDocument());
		AcDbLayerTable * pLayerTbl = NULL;
		Acad::ErrorStatus es =
		acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pLayerTbl,AcDb::kForRead);
		if (pLayerTbl->has(sHatchLayer))
		{
			AcDbLayerTableRecord * pLayerTbRcd = NULL;
			es = pLayerTbl->getAt(sHatchLayer,pLayerTbRcd,AcDb::kForWrite);
			pLayerTbRcd->setIsOff(bShow == 0);
			pLayerTbRcd->close();
			hasHatch = true;
		}
		pLayerTbl->close();
		acDocManager->unlockDocument(acDocManager->curDocument());
	}

	while(hChild != NULL)
	{
		ShowLayer(hChild, bShow);
		hChild = m_tree.GetNextItem(hChild,TVGN_NEXT);
	}
}
开发者ID:fredrikjonsson,项目名称:cadof72bian,代码行数:36,代码来源:LayerTreeDlg.cpp

示例13: GetWorkingDB

Acad::ErrorStatus TWArxLayer::Create( OUT AcDbObjectId& IdLayer ) const
{
	if( m_strName.IsEmpty() ) return Acad::eInvalidInput;

	AcDbDatabase* pDb = GetWorkingDB();

	Acad::ErrorStatus es = Acad::eKeyNotFound;

	AcDbLayerTable* pLayerTb = NULL;
	es = pDb->getLayerTable( pLayerTb,AcDb::kForRead );
	if( pLayerTb == NULL ) return es;
	
	es = pLayerTb->getAt( m_strName, IdLayer );
	if( es == Acad::eOk )
	{
		pLayerTb->close();
		return es;
	}

	es = pLayerTb->upgradeOpen();

	AcDbLayerTableRecord* pLtr = new AcDbLayerTableRecord;
	pLtr->setName( m_strName );
	pLtr->setIsFrozen( m_bIsFrozen );
	pLtr->setIsLocked( m_bIsLocked );
	pLtr->setIsOff( m_bIsOff );

	es = pLayerTb->add( IdLayer, pLtr );
	pLayerTb->close();

	if( es == Acad::eOk )
	{
		pLtr->close();
		return es;
	}

	TWFreePtr( pLtr );
	return es;
}
开发者ID:jiangnanemail,项目名称:WorkingDB,代码行数:39,代码来源:TWArxTool.cpp

示例14: AddEntityToLayer

// This command demonstrates the use of kCleanup / kReuse flags
void AddEntityToLayer (AsdkHlrCollector &collector, ACHAR *layerName) {
    //----- Check layer
    if ( layerName != NULL && *layerName != ACRX_T('\0') ) {
        AcDbDatabase *pDb =acdbHostApplicationServices ()->workingDatabase () ;
        AcDbLayerTable *pLayerTable ;
        pDb->getLayerTable (pLayerTable, AcDb::kForRead) ;
        if ( !pLayerTable->has (layerName) ) {
            AcDbLayerTableRecord *pLayerRecord =new AcDbLayerTableRecord ;
            pLayerRecord->setName (layerName) ;
            pLayerTable->upgradeOpen () ;
            pLayerTable->add (pLayerRecord) ;
            pLayerTable->downgradeOpen () ;
            pLayerRecord->close () ;
            pLayerTable->close () ;
            applyCurDwgLayerTableChanges () ;
        } else {
            pLayerTable->close () ;
        }
    } else {
        layerName =NULL ;
    }
    //----- Assign color to the resulting entities
    //----- red for visible edges
    //----- blue for non-visible edges
    //----- yellow for internal edges
    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) ; //----- Read
        } else if ( vis == AsdkHlrData::kInternallyHidden ) {
            if ( p->getHlrVisibility () == AsdkHlrData::kVisible )
                pEnt->setColorIndex (2) ; //----- Yellow
            else
                pEnt->setColorIndex (3) ; //----- Green
        } else {
            pEnt->setColorIndex (5) ; //----- Blue
        }
        if ( layerName != NULL )
            pEnt->setLayer (layerName) ;
        AcDbObjectId id ;
        if ( postToDatabase (NULL, pEnt, id) != Acad::eOk ) {
            acutPrintf (_T("Failed to add entity to current space.\n")) ;
            break ;
        }

        //----- Entity originator path for block reference entities
        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 () ;
    }
}
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:62,代码来源:HlrArxSampleCommands.cpp

示例15: DelLayer

void DelLayer()
{
	ACHAR szNewName[256];
	_tcscpy(szNewName, _T("NewLayer"));
	AcDbDatabase* pCurDb = acdbHostApplicationServices()->workingDatabase();
	if (pCurDb == NULL)
	{
		acutPrintf(_T("\nError:Current database is NULL!"));
		return;
	}

	bool bHas = false;
	bool bDeled = false;
	Acad::ErrorStatus es;
	AcDbObjectId layerId;
	AcDbLayerTable* pLayerTbl = NULL;
	es = pCurDb->getLayerTable(pLayerTbl, AcDb::kForRead);
	if (es == Acad::eOk)
	{
		if (pLayerTbl->has(szNewName))
		{
			AcDbLayerTableRecord* pLayerTblRcd = NULL;
			AcDbLayerTableIterator* pLTblIter = NULL;
			pLayerTbl->newIterator(pLTblIter);

			for (pLTblIter->start(); !pLTblIter->done(); pLTblIter->step())
			{
				ACHAR* szLayerName = NULL;
				pLTblIter->getRecord(pLayerTblRcd, AcDb::kForWrite, true);
				if (pLayerTblRcd)
				{
					pLayerTblRcd->getName(szLayerName);
					if (_tcscmp(szNewName, szLayerName) == 0)
					{
						es = pLayerTblRcd->erase(true);
						if (es == Acad::eOk)
						{
							bDeled = true;
						}
					}

					if (szLayerName)
					{
						ads_free(szLayerName);
					}

					pLayerTblRcd->close();
				}
			}

			if (pLTblIter)
			{
				delete pLTblIter;
				pLTblIter = NULL;
			}
		}

		pLayerTbl->close();
	}

	if (bDeled)
	{
		acutPrintf(_T("\nErased the layer: \"%s\" successfully!"), szNewName);
	}
	else
	{
		acutPrintf(_T("\nFailed to erase the layer: \"%s\""), szNewName);
	}
}
开发者ID:kevinzhwl,项目名称:ZRXSDKMod,代码行数:69,代码来源:LayerSample.cpp


注:本文中的AcDbLayerTableRecord类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。