ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

attributes are placed in 0,0 position

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
Moshe-A
462 Views, 9 Replies

attributes are placed in 0,0 position

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

 

9 REPLIES 9
Message 2 of 10
Moshe-A
in reply to: Moshe-A

foregot to mention that audit results no errors

Message 3 of 10
owenwengerd
in reply to: Moshe-A

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

--
Owen Wengerd
ManuSoft
Message 4 of 10
Moshe-A
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

 

 

Message 5 of 10
owenwengerd
in reply to: Moshe-A

Yes, and yes.

--
Owen Wengerd
ManuSoft
Message 6 of 10
Moshe-A
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

 

 

Message 7 of 10
Moshe-A
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?

 

 

 

 

Message 8 of 10
owenwengerd
in reply to: Moshe-A

Try instead AcDbHostApplicationServices::setWorkingDatabase().

--
Owen Wengerd
ManuSoft
Message 9 of 10
Moshe-A
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

 

Message 10 of 10
owenwengerd
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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost