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

wblock and ucs

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
353 Views, 2 Replies

wblock and ucs

Hi all!

The following code-snippet "copies" an unnamed block with all
of its entities. It works fine when working with wcs coordinates,
but if the user switches to an object-related ucs or similar, the
entities of the copied block are rotated/moved when using wblock.

Is there any possibility to "ignore" the ucs while wblock?

Thanks in advance
Markus

// ---- Code

AcDbObjectIdArray IdArray;
for(BlockIter->start(); !BlockIter->done(); BlockIter->step()){
AcDbObjectId EntId;
if(BlockIter->getEntityId(EntId) == Acad::eOk)
IdArray.append(EntId);
}

pRec->close();
pTable->close();
delete BlockIter;

if(IdArray.isEmpty()){
return(false);
}

AcDbDatabase *pTemp = NULL;

Acad::ErrorStatus es = pDwg->wblock(pTemp, IdArray,
AcGePoint3d::kOrigin);
if(es != Acad::eOk){
return(false);
}
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

Hi,

You can try this:
1. Catch the AcEditorReactor::beginWblock event, temporarily change the
unnamed block from UCS to WCS and record the transformation matrix.
2. Catch the AcEditorReactor::endWblock event, change the unnamed block back
to UCS using the inversed matrix of the recorded one.
This process can ensure that the block in source database keeps unchanged
while the copied block in destination database is in WCS.

Thanks
-Jerry




"Markus Griesser" дÈëÏûÏ¢ÐÂÎÅ:5075245@discussion.autodesk.com...
Hi all!

The following code-snippet "copies" an unnamed block with all
of its entities. It works fine when working with wcs coordinates,
but if the user switches to an object-related ucs or similar, the
entities of the copied block are rotated/moved when using wblock.

Is there any possibility to "ignore" the ucs while wblock?

Thanks in advance
Markus

// ---- Code

AcDbObjectIdArray IdArray;
for(BlockIter->start(); !BlockIter->done(); BlockIter->step()){
AcDbObjectId EntId;
if(BlockIter->getEntityId(EntId) == Acad::eOk)
IdArray.append(EntId);
}

pRec->close();
pTable->close();
delete BlockIter;

if(IdArray.isEmpty()){
return(false);
}

AcDbDatabase *pTemp = NULL;

Acad::ErrorStatus es = pDwg->wblock(pTemp, IdArray,
AcGePoint3d::kOrigin);
if(es != Acad::eOk){
return(false);
}
Message 3 of 3
Anonymous
in reply to: Anonymous

Many thanks for your reply.
I will try to do this.

br
Markus
>
> You can try this:
> 1. Catch the AcEditorReactor::beginWblock event, temporarily change the
> unnamed block from UCS to WCS and record the transformation matrix.
> 2. Catch the AcEditorReactor::endWblock event, change the unnamed block back
> to UCS using the inversed matrix of the recorded one.
> This process can ensure that the block in source database keeps unchanged
> while the copied block in destination database is in WCS.
>
> Thanks
> -Jerry

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

Post to forums  

Autodesk Design & Make Report

”Boost