ObjectARX

Reply
Distinguished Mentor
Moshe-A
Posts: 745
Registered: ‎09-14-2003
Message 1 of 9 (292 Views)
Accepted Solution

findout dynamic block

292 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
Alexander.Rivilis
Posts: 1,431
Registered: ‎04-09-2008
Message 2 of 9 (278 Views)

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
Moshe-A
Posts: 745
Registered: ‎09-14-2003
Message 3 of 9 (272 Views)

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
Alexander.Rivilis
Posts: 1,431
Registered: ‎04-09-2008
Message 4 of 9 (270 Views)

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
Moshe-A
Posts: 745
Registered: ‎09-14-2003
Message 5 of 9 (265 Views)

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
Moshe-A
Posts: 745
Registered: ‎09-14-2003
Message 6 of 9 (252 Views)

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
Alexander.Rivilis
Posts: 1,431
Registered: ‎04-09-2008
Message 7 of 9 (241 Views)

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
Moshe-A
Posts: 745
Registered: ‎09-14-2003
Message 8 of 9 (234 Views)

Re: findout dynamic block

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

got it, thank you

 

 

Moderator
Alexander.Rivilis
Posts: 1,431
Registered: ‎04-09-2008
Message 9 of 9 (233 Views)

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
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.