ObjectARX

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

findout dynamic block

269 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

 

Moderator
Alexander.Rivilis
Posts: 1,398
Registered: ‎04-09-2008
Message 2 of 9 (255 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: 738
Registered: ‎09-14-2003
Message 3 of 9 (249 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,398
Registered: ‎04-09-2008
Message 4 of 9 (247 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: 738
Registered: ‎09-14-2003
Message 5 of 9 (242 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: 738
Registered: ‎09-14-2003
Message 6 of 9 (229 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,398
Registered: ‎04-09-2008
Message 7 of 9 (218 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: 738
Registered: ‎09-14-2003
Message 8 of 9 (211 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,398
Registered: ‎04-09-2008
Message 9 of 9 (210 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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community