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

    Autodesk ObjectARX

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

    attributes are placed in 0,0 position

    124 Views, 9 Replies
    11-07-2012 10:28 PM

    Hi Guys,

     

    In my application i have three block symbols contains some attributes. the current task i'm working on

    is converting an old version of these blocks (the new version also are dynamic blocks)

     

    let's say i have a host database that has a xref in and the xref contains the old blocks.

    i scan the current database (AcDbBlockTableRecord) for that xref, open it and scan the xref database (AcDbBlockTableRecord) for those blocks it turn i find each block make an update insert (insert= from outside database) and replace each AcDbBlockReference. this all process work fine except the attributes at first are places

    on the 0,0 position. after audit the xref and regen it, the attributes are restores in place were they should be.

     

    would like to mention that i did not encounter this problem when i insert the blocks in the current database

    or even replacing the symbols inside a standard block.

     

    Any one knows what is my problem?

     

    thanks in advance

    moshe

     

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

    Re: attributes are placed in 0,0 position

    11-08-2012 04:10 AM in reply to: Moshe-A

    foregot to mention that audit results no errors

    Please use plain text.
    Mentor
    Posts: 239
    Registered: ‎08-06-2002

    Re: attributes are placed in 0,0 position

    11-08-2012 07:20 AM in reply to: Moshe-A

    Have you tried setting the database current before adding the attributes?

    --
    Owen Wengerd
    ManuSoft
    Please use plain text.
    Distinguished Mentor
    Moshe-A
    Posts: 673
    Registered: ‎09-14-2003

    Re: attributes are placed in 0,0 position

    11-08-2012 10:27 AM in reply to: owenwengerd

    Hi Owen,

     

    NO

     

    What do you mean by that? to set the Xref database current?

    can i do that without closing the host database?

     

    thanx

    Moshe

     

     

    Please use plain text.
    Mentor
    Posts: 239
    Registered: ‎08-06-2002

    Re: attributes are placed in 0,0 position

    11-08-2012 06:32 PM in reply to: Moshe-A

    Yes, and yes.

    --
    Owen Wengerd
    ManuSoft
    Please use plain text.
    Distinguished Mentor
    Moshe-A
    Posts: 673
    Registered: ‎09-14-2003

    Re: attributes are placed in 0,0 position

    11-09-2012 12:34 AM in reply to: owenwengerd

    tried it and it still doesn't work, hope i use it good (cause i have never used AcApDocumentManager)

     

    here's what i did

     

    ACHAR XrefFile[32= = _T("xref.dwg");
    AcDbDatabase *pXref = NULL;
    
    // allocating memory
    pXref = new AcDbDatabase(Adesk::kFalse);
    pXref->readDwgFile(XrefFile);		{
    // switch databases
    acDocManager->setCurDocument(acDocManager->document(pXref));
    
    replace_old_symbols(pXref); // real work
    
    // restore current database
    acDocManager->setCurDocument(acDocManager->document(pCurDwg));
    pXref->saveAs(XrefFile);
    delete pXref; // dispose memory

     

     

    i would like to understand why is this happends - do you have explanation?

     

    Moshe

     

     

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

    Re: attributes are placed in 0,0 position

    11-09-2012 02:19 AM in reply to: Moshe-A

    Owen,

     

    here's a simple test is did:

     

    i draw a rectangle on the current database (with RECTANGLE command)

    disable the call to restore the current database

     

    // acDocManager->setCurDocument(acDocManager->document(pCurDwg));

     

    then build & load & run my application again

    then i tried to select the rectangle and i did successed

    i thought if the xref database is current i won't be able to select objects in pCurDwg

     

    is this means that the call

     

    acDocManager->setCurDocument(acDocManager->document(pXref))

     

    is not acutally done?

     

     

     

     

    Please use plain text.
    Mentor
    Posts: 239
    Registered: ‎08-06-2002

    Re: attributes are placed in 0,0 position

    11-09-2012 07:27 AM in reply to: Moshe-A

    Try instead AcDbHostApplicationServices::setWorkingDatabase().

    --
    Owen Wengerd
    ManuSoft
    Please use plain text.
    Distinguished Mentor
    Moshe-A
    Posts: 673
    Registered: ‎09-14-2003

    Re: attributes are placed in 0,0 position

    11-09-2012 07:49 AM in reply to: owenwengerd

    Hallelujah!

     

    it's working fine

     

    thank you very much owen

     

    i'm sure you have explanation to this and i understand it's related to display and graphics

    but why does this happends only to attributes?

     

    Moshe

     

    Please use plain text.
    Mentor
    Posts: 239
    Registered: ‎08-06-2002

    Re: attributes are placed in 0,0 position

    11-09-2012 08:54 AM in reply to: Moshe-A

    I can only speculate that calculating text position after an alignment change requires information from the working database, and that the process is intentionally skipped or fails for some reason when the working database is different from the database of the target text object.

    --
    Owen Wengerd
    ManuSoft
    Please use plain text.