• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk ObjectARX

    Reply
    Distinguished Mentor
    Moshe-A
    Posts: 681
    Registered: ‎09-14-2003
    Accepted Solution

    findout dynamic block

    181 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

     

    Please use plain text.
    Moderator
    Alexander.Rivilis
    Posts: 1,178
    Registered: ‎04-09-2008

    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

    Please use plain text.
    Distinguished Mentor
    Moshe-A
    Posts: 681
    Registered: ‎09-14-2003

    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

     

     

     

    Please use plain text.
    Moderator
    Alexander.Rivilis
    Posts: 1,178
    Registered: ‎04-09-2008

    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

    Please use plain text.
    Distinguished Mentor
    Moshe-A
    Posts: 681
    Registered: ‎09-14-2003

    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

    Please use plain text.
    Distinguished Mentor
    Moshe-A
    Posts: 681
    Registered: ‎09-14-2003

    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

     

    Please use plain text.
    Moderator
    Alexander.Rivilis
    Posts: 1,178
    Registered: ‎04-09-2008

    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

    Please use plain text.
    Distinguished Mentor
    Moshe-A
    Posts: 681
    Registered: ‎09-14-2003

    Re: findout dynamic block

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

    got it, thank you

     

     

    Please use plain text.
    Moderator
    Alexander.Rivilis
    Posts: 1,178
    Registered: ‎04-09-2008

    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

    Please use plain text.