ObjectARX

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

findout dynamic block

313 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,458
Registered: ‎04-09-2008
Message 2 of 9 (299 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: 829
Registered: ‎09-14-2003
Message 3 of 9 (293 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,458
Registered: ‎04-09-2008
Message 4 of 9 (291 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: 829
Registered: ‎09-14-2003
Message 5 of 9 (286 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: 829
Registered: ‎09-14-2003
Message 6 of 9 (273 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,458
Registered: ‎04-09-2008
Message 7 of 9 (262 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: 829
Registered: ‎09-14-2003
Message 8 of 9 (255 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,458
Registered: ‎04-09-2008
Message 9 of 9 (254 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
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.