BlockReference Problem.

BlockReference Problem.

Anonymous
Not applicable
434 Views
3 Replies
Message 1 of 4

BlockReference Problem.

Anonymous
Not applicable
Hi. Does Any One Can Help Me With This Problem Please ? I Do wBlockCloneObjects() and after it i run on newly created objects, when i meet some block i should move it. I Try use blockTransferby(), Transferby(), setPosition() but no one from this procs dosn't do the work. Any One Please Maybe some onr already did such things. Thanks A Lot.
0 Likes
435 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Iggo wrote: > Hi. > > Does Any One Can Help Me With This Problem Please ? > > I Do wBlockCloneObjects() and after it i run on newly created objects, when > i meet some block i should move it. > I Try use blockTransferby(), Transferby(), setPosition() but no one from > this procs dosn't do the work. > > Any One Please Maybe some onr already did such things. > > Thanks A Lot. > > Iggo, You've been banging away with the same question for weeks now. Perhaps you should post some code. Obviously it is possible to move a block reference (which I believe is your goal). It sounds like you're moving the entities in the block table record instead... We all speak C++ here, your code plus your intentions should get you some results :) -- Best regards, Byron Blattel CADwerx--Applications for AutoCAD Autodesk Registered Developer Contact Info @ http://www.cadwerx.net Custom Programming Services - ObjectARX/C++/MFC/ASP/STL/ATL/ISAPI...
0 Likes
Message 3 of 4

Anonymous
Not applicable
Hi.

There is 3 functions that i wrote.
The place that i move the block can be found by "Find "BLOCKMOVE" String in
the Code.

The Main Idea that i run over all objects in current MODEL_SPACE and put all
onjects to ArrayList,
then i create new AcDbDatabase an read some file inside. I use
"wblockCloneObjects" to copy all object in array to a new Database.
Than i create some new layer inside new Database and move one by one new
created objects to this new layer after it i move each entity to new
position by using "transformBy" except "AcDbBlockReference" becouse this not
work.

I very appreciate for you help. Thanks Again.



"Byron Blattel" <byronatcadwerxdotnet> wrote in message
news:3fed1b5c$1_5@statler...
> Iggo wrote:
> > Hi.
> >
> > Does Any One Can Help Me With This Problem Please ?
> >
> > I Do wBlockCloneObjects() and after it i run on newly created objects,
when
> > i meet some block i should move it.
> > I Try use blockTransferby(), Transferby(), setPosition() but no one from
> > this procs dosn't do the work.
> >
> > Any One Please Maybe some onr already did such things.
> >
> > Thanks A Lot.
> >
> >
> Iggo,
>
> You've been banging away with the same question for weeks now. Perhaps
> you should post some code. Obviously it is possible to move a block
> reference (which I believe is your goal). It sounds like you're moving
> the entities in the block table record instead...
>
> We all speak C++ here, your code plus your intentions should get you
> some results 🙂
>
> --
> Best regards,
>
> Byron Blattel
> CADwerx--Applications for AutoCAD
> Autodesk Registered Developer
> Contact Info @ http://www.cadwerx.net
> Custom Programming Services - ObjectARX/C++/MFC/ASP/STL/ATL/ISAPI...



Attachment not added (too large): "SomeCode.cpp"
0 Likes
Message 4 of 4

Anonymous
Not applicable
Iggo wrote: > Hi. > > There is 3 functions that i wrote. > The place that i move the block can be found by "Find "BLOCKMOVE" String in > the Code. > > The Main Idea that i run over all objects in current MODEL_SPACE and put all > onjects to ArrayList, > then i create new AcDbDatabase an read some file inside. I use > "wblockCloneObjects" to copy all object in array to a new Database. > Than i create some new layer inside new Database and move one by one new > created objects to this new layer after it i move each entity to new > position by using "transformBy" except "AcDbBlockReference" becouse this not > work. > > I very appreciate for you help. Thanks Again. > Try using the same translation for AcDbBlockReference's that you are using for all other entities. In other words, don't treate the block references separately. In addition, iterate the block table records for all regular blocks and translate the origin as well... AcGeMatrix3d m; AcGeVector3d v(m_MainDatum.x - m_DatumPoint.x, m_MainDatum.y - m_DatumPoint.y, m_MainDatum.z - m_DatumPoint.z); m.setToTranslation(v); AcGePoint3d pntOrigin = blkTblRec->origin(); pntOrigin.transformBy(m); blkTblRec->setOrigin(pntOrigin); This may be more involved if the same block exists in more than one source drawing and the final translations are different. You should probably keep track of BTR's whose origin's have been translated already. You also might want to reconsider using AcDb::kDrcReplace in your call to wblockCloneObjects(), perhaps AcDb::kDrcIgnore might be better... Also, I believe it's better to use m.setToTranslation() rather than setTranslation() when your intention is to have a matrix that just represents the translation (no scaling, rotation, mirroring, etc). Hope this helps :) -- Best regards, Byron Blattel CADwerx--Applications for AutoCAD Autodesk Registered Developer Contact Info @ http://www.cadwerx.net Custom Programming Services - ObjectARX/C++/MFC/ASP/STL/ATL/ISAPI...
0 Likes