ObjectARX

Reply
Distinguished Mentor
831 Posts
38 Kudos
Registered: ‎09-14-2003
Post 1 of 9
Accepted Solution

findout dynamic block

319 Views, 8 Replies
10-02-2012 07:31 AM

Hi,

 

Is there a way to findout that AcDbBlockTableRecord is dynamic block except of iterating it?

 

thanks in advance

moshe

 


Moshe-A wrote:

got it, thank you

 

 


And what about Accept solution? :smileyhappy:

 

Moderator
1,464 Posts
277 Kudos
Registered: ‎04-09-2008
Post 2 of 9

Re: findout dynamic block

10-02-2012 02:14 PM in reply to: Moshe-A
static bool AcDbDynBlockReference::isDynamicBlock( AcDbObjectId blockTableRecordId );

 This method help you to identify if block is dynamic or no.


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Distinguished Mentor
831 Posts
38 Kudos
Registered: ‎09-14-2003
Post 3 of 9

Re: findout dynamic block

10-02-2012 02:49 PM in reply to: Alexander.Rivilis

Alexander,

 

thanx for your reply.

 

but that not what i'm asking, i what to know if AcDbBlockTableRecord is dynamic?

 

let's say i have in database some old blocks version in AcDbBlockTable and i want to upgrade them to a new

version which is dynamic. with AcDbDynBlockReference::isDynamicBlock() i have to catch one

block reference and check it...but what if there isn't any insert? should i do a dummy insert to check it?

that's sounds unlogic.

 

Moshe

 

 

 

Moderator
1,464 Posts
277 Kudos
Registered: ‎04-09-2008
Post 4 of 9

Re: findout dynamic block

10-02-2012 02:58 PM in reply to: Moshe-A

Moshe-A wrote:

Alexander,

 

but what if there isn't any insert? should i do a dummy insert to check it?

No. This method is static. That is why you can use it same way:

AcDbObjectId idBTR; // id of BlockTableRecord
if (AcDbDynBlockReference::isDynamicBlock(idBTR)) {
  acutPrintf(_T("\nBlock is dynamic"));  
} else {
  acutPrintf(_T("\nBlock is not dynamic"));  
}

 

 


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Distinguished Mentor
831 Posts
38 Kudos
Registered: ‎09-14-2003
Post 5 of 9

Re: findout dynamic block

10-02-2012 03:08 PM in reply to: Alexander.Rivilis

i'm sorry Alex, you are right, my mistake

 

thank you

Distinguished Mentor
831 Posts
38 Kudos
Registered: ‎09-14-2003
Post 6 of 9

Re: findout dynamic block

10-02-2012 10:52 PM in reply to: Alexander.Rivilis

Alexander,

 

wait...

 

In order to be able to use ->  AcDbDynBlockReference::isDynamicBlock(AcDbObjectId blockTableRecordId);

 

first you need to construct AcDbDynBlockReference with AcDbBlockReference object as an argument

 

AcDbDynBlockReference(AcDbBlockReference* pRef);

AcDbDynBlockReference(AcDbObjectId blockRefId);

 

so this send me back to start, Am i right?

 

moshe

 

Moderator
1,464 Posts
277 Kudos
Registered: ‎04-09-2008
Post 7 of 9

Re: findout dynamic block

10-03-2012 06:27 AM in reply to: Moshe-A

NO! NO! NO!

Are you know how to call static method of class? OK. Full sample:

static void CheckDynBlock(void)
{
    ACHAR blockName[512];
    if (acedGetString(TRUE,_T("\nBlock name: "), blockName) == RTNORM) {
        AcDbBlockTableRecordPointer pBTR(blockName, acdbCurDwg(), AcDb::kForRead);
        if (pBTR.openStatus() == Acad::eOk) {
            if (AcDbDynBlockReference::isDynamicBlock(pBTR->objectId())) {
                acutPrintf(_T("\nBlock <%s> is dynamic."), blockName);
            } else {
                acutPrintf(_T("\nBlock <%s> is not dynamic."), blockName);
            }
        } else {
            acutPrintf(_T("\nCan not open block <%s>. Error: <%s>"),
                blockName, acadErrorStatusText(pBTR.openStatus()));
        }
    }
}

 


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Distinguished Mentor
831 Posts
38 Kudos
Registered: ‎09-14-2003
Post 8 of 9

Re: findout dynamic block

10-03-2012 07:22 AM in reply to: Alexander.Rivilis

got it, thank you

 

 

Moderator
1,464 Posts
277 Kudos
Registered: ‎04-09-2008
Post 9 of 9

Re: findout dynamic block

10-03-2012 07:24 AM in reply to: Moshe-A

Moshe-A wrote:

got it, thank you

 

 


And what about Accept solution? :smileyhappy:

 


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post