Exemplo n.º 1
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();
}
Exemplo n.º 2
0
void DrawMText( AcGiWorldDraw* mode, const AcGePoint3d& pt, double angle, const CString& str, double height, AcDbMText::AttachmentPoint ap, const CString& style )
{
    //acutPrintf(_T("\n绘制前--文字颜色:%d"), mode->subEntityTraits().color());
    AcDbMText mt;

 //   //AcDbObjectId style; // 文字样式
	AcDbObjectId fontId = GetTextStyle(style);
	if(!fontId.isNull())
	{
		acutPrintf(_T("\n设置样式为罗马字体"));
		mt.setTextStyle(fontId);
	}
    mt.setLocation( pt );
    mt.setTextHeight( height );

	mt.setAttachment( ap );
    mt.setRotation( angle );

    mt.setContents( str );

    // 经过测试发现,AcDbMText调用worldDraw的同时会修改mode的一些属性
    mt.setColorIndex( mode->subEntityTraits().color() );
	
    mt.worldDraw( mode );

    //acutPrintf(_T("\n绘制后--文字颜色:%d"), mode->subEntityTraits().color());
}
Exemplo n.º 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;
}
Exemplo n.º 4
0
void
AsdkWblockReactor::otherWblock(AcDbDatabase*  pDestDb,
                               AcDbIdMapping& idMap,
                               AcDbDatabase*  pSrcDb)
{
    AcDbBlockTable       *pDestBlockTable;
    AcDbBlockTableRecord *pDestBTR;

    pDestDb->getSymbolTable(pDestBlockTable, AcDb::kForRead);
    pDestBlockTable->getAt(ACDB_MODEL_SPACE,
        pDestBTR, AcDb::kForRead);
    pDestBlockTable->close();

    // Now pDestBTR is pointing to pSrcDb database's Model
    // Space not to the destination database's Model Space!
    // The code above is not correct!

// END CODE APPEARING IN SDK DOCUMENT.

    acutPrintf("\nIncorrect destination BTR's ObjectId is \t\t%Ld",
        pDestBTR->objectId().asOldId());
    pDestBTR->close();

    AcDbBlockTable *pSrcBlockTable;
    AcDbObjectId    srcModelSpaceId;
    pSrcDb->getSymbolTable(pSrcBlockTable, AcDb::kForRead);
    pSrcBlockTable->getAt(ACDB_MODEL_SPACE,
        srcModelSpaceId);
    pSrcBlockTable->close();

    acutPrintf("\nSource Database's Model Space BTR's ObjectId is \t%Ld",
        srcModelSpaceId.asOldId());
}
Exemplo n.º 5
0
void DrawCmd::DrawJoint()
{
	AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一条巷道、或掘进工作面:" ) );
	if( objId.isNull() ) return;
	if( !ArxUtilHelper::IsEqualType( _T( "LinkedGE" ), objId ) ) return;

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

	AcDbObject* pObj;
	if( Acad::eOk != pTrans->getObject( pObj, objId, AcDb::kForWrite ) )
	{
		actrTransactionManager->abortTransaction();
		return;
	}

	LinkedGE* pEdge = LinkedGE::cast( pObj );
	if( pEdge == 0 )
	{
		actrTransactionManager->abortTransaction();
		return;
	}
	actrTransactionManager->endTransaction();
	AcGePoint3d spt,ept;
	pEdge->getSEPoint(spt,ept);
	AcGePoint3d pt;
	if( !PromptInsertPt( objId, pt ) ) return;

	double angle;
	if( !GetClosePtAndAngle( objId, pt, angle ) ) return;

	SplitByPoint(objId,spt,ept,pt);
	CreatJoint( objId, pt, angle );
}
void WindStationDockBarChildDlg::OnBnClickedAirSelBtn()
{
    // 拾取按钮
    //BeginEditorCommand();
    AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一条巷道: " ) );
    //CompleteEditorCommand();
    if( !objId.isNull() )
    {
        //MessageBox(_T("拾取成功"));
        int pos = m_objIds.find( objId );
        if( pos != -1 )
        {
            //滚动条自动滚动该行,并选中
            m_list.EnsureVisible( pos, FALSE );
            m_list.SetItemState( pos, LVIS_SELECTED, LVIS_SELECTED );

            // 取消选中
            //m_list.SetItemState(pos, NULL, NULL);
        }
    }
    else
    {
        MessageBox( _T( "拾取失败" ) );
    }
}
Exemplo n.º 7
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;
}
Exemplo n.º 8
0
void DrawCmd::DrawLocalFan()
{
    AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一条巷道:" ) );
    if( objId.isNull() ) return;
    if( !ArxUtilHelper::IsEqualType( _T( "LinkedGE" ), objId ) ) return;
	//if( !ArxUtilHelper::IsEqualType( _T( "Chimney" ), objId ) ) return;

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

    AcGePoint3d pt,insertPt;

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

	insertPt = pt;
	if( !GetClosePtAndAngle( objId, pt, angle ) ) return;
    Fan* pFan = new LocalFan( insertPt, angle ); 
    if( pFan == 0 ) return;

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

    // 初始化并提交到数据库
    if( !ArxUtilHelper::PostToModelSpace( pFan ) ) delete pFan;
}
Exemplo n.º 9
0
void BlockDraw::explodeBlock( AcGeVoidPointerArray& ents )
{
    // 填充属性数据
    AcStringArray names;
    regPropertyDataNames( names );
    if( names.isEmpty() )
    {
        acutPrintf( _T( "\n没有注册要提取的字段..." ) );
        return;
    }

    if( names.length() != m_attValues.length() )
    {
        acutPrintf( _T( "\n注册的属性数据与读取的数据个数不相等!" ) );
        return;
    }

    AcDbObjectId blkId = GetBlockDefinitionByName( m_blockName );
    if( blkId.isNull() )
    {
        acutPrintf( _T( "\n未知的块定义:%s" ), m_blockName );
        return;
    }

    // 计算变换矩阵
    AcGeMatrix3d blkXform = GetBlockTransformMatrix( blkId, m_insertPt, m_angle, m_scale );

    // 分解块定义
    BlockToEntity( blkId, blkXform, names, m_attValues, ents );
}
Exemplo n.º 10
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;
}
Acad::ErrorStatus
ArxDbgPersistentObjReactor::dxfInFields(AcDbDxfFiler* filer)
{
    Acad::ErrorStatus es;
    if (((es = AcDbObject::dxfInFields(filer)) != Acad::eOk) ||
        (filer->atSubclassData(this->desc()->name()) != Adesk::kTrue))
        return filer->filerStatus();

    resbuf rb;
	m_attachedToObjs.setLogicalLength(0);

    while ((es == Acad::eOk) && ((es = filer->readResBuf(&rb)) == Acad::eOk)) {
        if (rb.restype == AcDb::kDxfSoftPointerId) {
            AcDbObjectId tmpId;
            tmpId.setFromOldId(rb.resval.rlong);
            if (tmpId.isNull() == false)
                m_attachedToObjs.append(tmpId);
        }
        else {
            filer->pushBackItem();
            es = Acad::eEndOfFile;
        }
    }

    if (es != Acad::eEndOfFile)
        return Acad::eInvalidResBuf;

    return filer->filerStatus();
}
Acad::ErrorStatus
ArxDbgDbAdeskLogoStyle::dxfInFields(AcDbDxfFiler* filer)
{
    Acad::ErrorStatus es;
    if (((es = ArxDbgDbDictRecord::dxfInFields(filer)) != Acad::eOk) ||
        (filer->atSubclassData(this->desc()->name()) != Adesk::kTrue))
        return filer->filerStatus();

    resbuf rb;

    while ((es == Acad::eOk) && ((es = filer->readResBuf(&rb)) == Acad::eOk)) {
        if (rb.restype == kDxfSolidFill) {
			bool doSolidFill = (rb.resval.rint == 0) ? false : true;
            setSolidFill(doSolidFill);
		}
        else if (rb.restype == kDxfLabel)
            setLabel(rb.resval.rstring);        // NOTE: normally have to free string from resbuf... not in this case, DXF Filer does
        else if (rb.restype == kDxfTextStyle) {
            AcDbObjectId tmpId;
            tmpId.setFromOldId(rb.resval.rlong);
            setTextStyleId(tmpId);
        }
        else {
            filer->pushBackItem();
            es = Acad::eEndOfFile;
        }
    }

    if (es != Acad::eEndOfFile)
        return Acad::eInvalidResBuf;

    return filer->filerStatus();
}
Exemplo n.º 13
0
void DrawCmd::DrawWindLibrary( void )
{
	AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一条巷道:" ) );
	if( objId.isNull() ) return;
	if( !ArxUtilHelper::IsEqualType( _T( "LinkedGE" ), objId ) ) return;


	AcGePoint3d pt,insertPt;

	double angle;

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

	if( !GetClosePtAndAngle( objId, pt, angle ) ) return;

	AcGeVector3d v = AcGeVector3d(AcGeVector3d::kXAxis);
	v.rotateBy(angle - PI/2,AcGeVector3d::kZAxis);
	v.normalize();

	insertPt = pt + v * 60;

	WindLibrary* pWindLib = new WindLibrary( insertPt, angle ); 	
	if( pWindLib == 0 ) return;


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

	// 初始化并提交到数据库
	if( !ArxUtilHelper::PostToModelSpace( pWindLib ) ) delete pWindLib;

}
Exemplo n.º 14
0
ArxDictTool2* ArxDictTool2::GetDictTool( const CString& dictName )
{
    AcDbObjectId dictId = ArxDictTool::GetDict( dictName );
    if( dictId.isNull() )
        return 0;
    else
        return new ArxDictTool2( dictId );
}
Exemplo n.º 15
0
void UIHelper::DisplayData()
{
    // 显示图元的属性数据
    AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一个图元:" ) );
    if( objId.isNull() ) return;

    PropertyDataDlgHelper::DisplayPropertyDataDlg( objId );
}
Exemplo n.º 16
0
    // ----- AsdkSelectionFilterUI.SubentSel command (do not rename)
    static void AsdkSelectionFilterUI_SubentSel(void)
    {
        // we have to allow duplicates; otherwise, the xref would be selectable
        // only once (because the main entity is the one that counts).

        setAllowDuplicateSelection(curDoc(), true);
        ads_name sset, eName;
        AcDbObjectId id;

        // "_:n" gives us nested entities
        //
        if (RTNORM == acedSSGet("_:n", NULL, NULL, NULL, sset))
        {
            acutPrintf("\n");
            long len = 0;
            acedSSLength(sset, &len);
            for (long i = 0; i < len; i++)// For each entity in sset
            {

                resbuf *rb = NULL;
                // We use ssnamex() here, because the regular ssname()
                // would give only the main entity (the xref)
                //
                if (RTNORM == acedSSNameX(&rb, sset, i))//Get the sub entity
                {
                    resbuf *rbWalk = rb;
                    while (NULL != rbWalk)
                    {
                        if (RTENAME == rbWalk->restype)
                        {
                            eName[0] = rbWalk->resval.rlname[0];
                            eName[1] = rbWalk->resval.rlname[1];
                            if(Acad::eOk == acdbGetObjectId(id, eName))
                            {
                                acutPrintf("Entity %d: <%x>", i, id.asOldId());
                                AcDbEntity *pEnt;
                                if (Acad::eOk == acdbOpenObject(pEnt, id, AcDb::kForRead))
                                {
                                    acutPrintf("(%s)\n", pEnt->isA()->name());
                                    pEnt->close();
                                }
                                else
                                    acutPrintf("\nCouldn't open object");
                            }
                            rbWalk = NULL; //force quit out of loop
                        }
                        else
                            rbWalk = rbWalk->rbnext;
                    }
                    acutRelRb(rb);
                }
            }
            acedSSFree(sset);
        }

        setAllowDuplicateSelection(curDoc(), false);
    }
Exemplo n.º 17
0
void
AsdkWblockReactor::otherWblock(AcDbDatabase*  pDestDb,
                               AcDbIdMapping& idMap,
                               AcDbDatabase*  pSrcDb)
{
    // To find the destination Model Space,  you must look
    // it up in the ID map:

    AcDbBlockTable *pSrcBlockTable;
    pSrcDb->getSymbolTable(pSrcBlockTable, AcDb::kForRead);

    AcDbObjectId srcModelSpaceId;
    pSrcBlockTable->getAt(ACDB_MODEL_SPACE,
        srcModelSpaceId);
    pSrcBlockTable->close();

    AcDbIdPair idPair;
    idPair.setKey(srcModelSpaceId);
    idMap.compute(idPair);

    AcDbBlockTableRecord *pDestBTR;
    acdbOpenAcDbObject((AcDbObject*&)pDestBTR,
        idPair.value(), AcDb::kForRead, Adesk::kTrue);

// END CODE APPEARING IN SDK DOCUMENT.

    acutPrintf("\nCorrect destination BTR's ObjectId is:\t\t%Ld",
        pDestBTR->objectId().asOldId());
    pDestBTR->close();

    // Incorrect way done here so that the wrong value can be
    // compared to the correct value
    //
    AcDbBlockTable *pDestBlockTable;
    pDestDb->getSymbolTable(pDestBlockTable, AcDb::kForRead);
    pDestBlockTable->getAt(ACDB_MODEL_SPACE,
        pDestBTR, AcDb::kForRead);
    pDestBlockTable->close();

	acutPrintf("\nIncorrect destination BTR's ObjectId is \t\t%Ld",
        pDestBTR->objectId().asOldId());
    
	pDestBTR->close();

    // source database Model Space BTR's ObjectId is shown to
    // demonstrate that this is what the incorrect method gets
    //
    pSrcDb->getSymbolTable(pSrcBlockTable, AcDb::kForRead);
    pSrcBlockTable->getAt(ACDB_MODEL_SPACE,
        srcModelSpaceId);
    pSrcBlockTable->close();

    acutPrintf("\nSource Database's Model Space BTR's ObjectId is \t%Ld",
        srcModelSpaceId.asOldId());
}
Exemplo n.º 18
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());
}
Exemplo n.º 19
0
void DrawCmd::DrawDirection( void )
{
    AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一个巷道、采掘工作面、硐室:" ) );
    if( objId.isNull() ) return;
    if( !ArxUtilHelper::IsEqualType( _T( "LinkedGE" ), objId ) ) return;

    AcGePoint3d pt;
    if( !PromptInsertPt( objId, pt ) ) return;

    double angle;
    if( !GetClosePtAndAngle( objId, pt, angle ) ) return;

    CreateDirection( objId, pt, angle );
}
Exemplo n.º 20
0
void DrawCmd::DrawGate( int flag )
{
    AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一个巷道、硐室:" ) );
    if( objId.isNull() ) return;
    if( !ArxUtilHelper::IsEqualType( _T( "Tunnel" ), objId ) &&
            !ArxUtilHelper::IsEqualType( _T( "StorageGE" ), objId ) ) return;

    AcGePoint3d pt;
    if( !PromptInsertPt( objId, pt ) ) return;

    double angle;
    if( !GetClosePtAndAngle( objId, pt, angle ) ) return;

    CreateGate( flag, objId, pt, angle );
}
Exemplo n.º 21
0
void DrawCmd::DrawCasement( int flag )
{
    AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一个巷道、回采工作面、硐室:" ) );
    if( objId.isNull() ) return;
    if( !ArxUtilHelper::IsEqualType( _T( "LinkedGE" ), objId ) ) return;
    if( ArxUtilHelper::IsEqualType( _T( "TTunnel" ), objId ) ) return;

    AcGePoint3d pt;
    if( !PromptInsertPt( objId, pt ) ) return;

    double angle;
    if( !GetClosePtAndAngle( objId, pt, angle ) ) return;

    CreateCasement( flag, objId, pt, angle );
}
Exemplo n.º 22
0
void TTunnel::setInTunnel( const AcDbObjectId& objId )
{
    assertWriteEnabled();
    if( objId.isNull() ) return;
    if( m_inTunnel == objId ) return;
    m_inTunnel = objId;
}
Exemplo n.º 23
0
bool PropertyDataDlgHelper::DisplayPropertyDataDlg( const AcDbObjectId& objId )
{
    if( objId.isNull() ) return false;

    AcDbObjectId dObjId;
    if( !DataHelper::GetDataObject( objId, dObjId ) ) return false;

    CString type;
    if( !DataHelper::GetTypeName( objId, type ) ) return false;

    AcStringArray fields;
    FieldHelper::GetAllFields( type, fields );
	//acutPrintf(_T("\n类型:%s"),type);
    if( fields.isEmpty() )
    {
        CString msg;
        //msg.Format(_T("类型:%s的字段个数为0,没有数据可以显示..."), type);
        msg.Format( _T( "没有数据可以显示..." ) );
        AfxMessageBox( msg );
        return false;
    }
    else
    {
		DisplayPartialPropertyDataDlg( dObjId, fields );
        return true;
    }
}
Exemplo n.º 24
0
bool ReportDataHelper::SetObjectDatas( const AcDbObjectId& objId,const AcStringArray& values )
{
	if( objId.isNull() ) return false;

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

	AcDbObject* pObj;
	if( Acad::eOk != pTrans->getObject( pObj, objId, AcDb::kForWrite ) )
	{
		actrTransactionManager->abortTransaction();
		return false;
	}
	DataObject* pDO = DataObject::cast( pObj );
	if( pDO == 0 )
	{
		actrTransactionManager->abortTransaction();
		return false;
	}

	pDO->clearAll();
	for(int i = 0;  i < values.length(); i++)
	{
		CString value = values[i].kACharPtr();
		pDO->addData();
		pDO->setData(i,value);
	}
	actrTransactionManager->endTransaction();
	return true;
}
Exemplo n.º 25
0
bool PropertyDataDlgHelper::DisplayPropertyByFunName( const AcDbObjectId& objId, const CString funName )
{
	if( objId.isNull() ) return false;

	AcDbObjectId dObjId;
	if( !DataHelper::GetDataObject( objId, dObjId ) ) return false;

	CString type;
	if( !DataHelper::GetTypeName( objId, type ) ) return false;

	AcStringArray fields;
	FuncFieldHelper::GetFields(funName,type,fields);
	//for (int i = 0; i < fields.length(); i++)
	//{
	//	acutPrintf(_T("\n功能:%s\t字段:%s"),funName,fields[i]);
	//}
	//FieldHelper::GetAllFields( type, fields );
	if( fields.isEmpty() )
	{
		CString msg;
		//msg.Format(_T("类型:%s的字段个数为0,没有数据可以显示..."), type);
		msg.Format( _T( "没有数据可以显示..." ) );
		AfxMessageBox( msg );
		return false;
	}
	InputPropertyDataDlg( dObjId, fields,funName );
	return true;
}
Exemplo n.º 26
0
// 设置独立用风分支
// 独立用风地点:采掘工作面、采区变电所
static bool SetEdgeType( const AcDbObjectId& objId, EdgeData* pEdgeData )
{
    bool ret = true;
    if( objId.isNull() )
    {
        pEdgeData->et = ET_VIRTUAL;
    }
    else if( ArxUtilHelper::IsEqualType( _T( "WorkSurface" ), objId ) )
    {
        pEdgeData->et = ET_USEAIR;  // 工作面
    }
    else if( ArxUtilHelper::IsEqualType( _T( "StorageGE" ), objId ) )
    {
        if( !ArxUtilHelper::IsEqualType( _T( "MachineRoom" ), objId ) )
        {
            pEdgeData->et = ET_USEAIR;  // 火药库或充电室
        }
        else if( IsPowerSubstation( objId ) )
        {
            pEdgeData->et = ET_USEAIR;  // 机电硐室--变电所(用风地点)
        }
    }
    else if( ArxUtilHelper::IsEqualType( _T( "TTunnel" ), objId ) )
    {
        pEdgeData->et = ET_USEAIR;  // 掘进工作面
    }
    /*else if(IsNeedAir(objId))
    {
    	pEdgeData->et = ET_USEAIR;
    }*/
    return ret;
}
Exemplo n.º 27
0
static bool CheackTubeLenth(AcDbObjectId& objId)
{
	objId = ArxUtilHelper::SelectObject( _T( "请选择一条瓦斯管路:" ) );
	if( objId.isNull() ) return false;
	if( !ArxUtilHelper::IsEqualType( _T( "GasTube" ), objId ) ) return false;

	AcTransaction *pTrans = actrTransactionManager->startTransaction();
	if ( 0 == pTrans ) return false;
	AcDbObject *pObj;
	if (Acad::eOk != pTrans->getObject(pObj,objId,AcDb::kForRead)) return false;
	GasTube *pGasTube = GasTube::cast(pObj);
	if ( 0 == pGasTube)
	{
		actrTransactionManager->abortTransaction();
		return false;
	}
	AcGePoint3d spt,ept;
	pGasTube->getSEPoint(spt,ept);
	//double angle = pGasTube->getAngle();
	actrTransactionManager->endTransaction();

	AcGeVector3d v = ept - spt;
	double tubeLenth = v.length();
	return true;
}
Exemplo n.º 28
0
void CMyDlg::OnSelectLine()
{
	// TODO: Add your control notification handler code here
	ads_name adsNameSet, adsName;
	AcDbObjectId objId;
	int ret = 0;
	long lSelCnt = 0;
	AcDbEntity *pEnt = NULL;
	int nCount = m_ListCtr.GetItemCount();
	long lId;
	CString str;
	AcDbObjectId LineId;

	acDocManager->lockDocument(curDoc());

	ShowWindow(SW_HIDE);
	ret = acedSSGet(NULL, NULL, NULL, NULL, adsNameSet);
	
	if (RTNORM == ret)
	{
		m_ListCtr.SetFocus();
		acedSSLength(adsNameSet, &lSelCnt);
		for (long i = 0; i < lSelCnt; ++i)
		{
			acedSSName(adsNameSet, i, adsName);
			acdbGetObjectId(objId, adsName);
			if (nCount > 0)
			{
				for (int i = 0; i < nCount; ++i)
				{
					str = m_ListCtr.GetItemText(i, 0);
					lId = atol(str);
					LineId.setFromOldId(lId);
					if (LineId == objId)
					{				
						m_ListCtr.SetItemState(i, LVIS_SELECTED, LVIS_SELECTED);
					}
				}
			}			
		}
		ShowWindow(SW_SHOW);
	}

	acedSSFree(adsName);
//	acutRelRb(stResBuf);
	acDocManager->unlockDocument(curDoc());
}
Exemplo n.º 29
0
void DrawCmd::DrawGasFlow()
{
	AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一条管路:" ) );
	if( objId.isNull() ) return;
	if( !ArxUtilHelper::IsEqualType( _T( "GasTube" ), objId ) ) return;

	AcGePoint3d pt;
	if( !PromptInsertPt( objId, pt ) ) return;

	double angle;
	if( !GetClosePtAndAngle( objId, pt, angle ) ) return;

	CreateGasFlow( objId, pt, angle );
	//CString v;
	//DataHelper::GetPropertyData(objId,_T("瓦斯流量"),v);
	//acutPrintf(_T("\n值:%s"),v);
}
Exemplo n.º 30
0
void TagGE::setRelatedGE( const AcDbObjectId& objId )
{
    assertWriteEnabled();
    if( objId.isNull() || ( objId == m_objId ) ) return;
    if( objId == objectId() ) return;                            // 不能和图元自身关联
    if( !ArxUtilHelper::IsEqualType( _T( "MineGE" ), objId ) ) return; // 必须从MineGE派生

    m_objId = objId;
}