- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
i have the following issue. I created a block. Every instance of this block has a set of data, that is to big for using XData so i decided to make a custom Entity. First I tried extending AcDbBlockReference but since my block has an attribute I had to learn that I can't append attributes to a class deriving from AcDbBlockReference. So my next try was to nest a AcDbBlockReference in a Class deriving from AcDbEntity (I am calling the worldDraw of my nested BlockReference inside of my subworlddraw to draw it). That worked fine until I tried to change the appearance of the attribute.
What I need to do is depending of the angle (rotation) that I am inserting the block with, I need to rotate the attribute. I managed to do that by setting the alignmentPoint to the PositionPoint, chaning the alignment to topright instead of bottomleft and setting the rotation of the TextAttribute to 180 degrees more than the rotation of the inserted block.
That works fine when I am adding just the BlockReference I created to the ModelSpace. But when I try to add my custom object to the ModelSpace, that has the BlockReference nested inside of it, it does'nt work anymore. The rotation of the attribute is updated but not the alignment and changes to the alignementPoint.
I think I may be missing a method override of BlockReference for my custom class, but I can't figure out what it could be. Maybe one of you have already had a simular problem and can help me?
I also tried to extend AcDbBlockReference instead of AcDbEntity and still nest my BlockReference Object inside of this class to support the attributes. And when I am setting the nested BlockReference pointer I tried to set the important values to the deriving class like so:
void setBlockRef(AcDbBlockReference * pBlockRef) {
m_pBlockRef = pBlockRef;
setRotation(m_pBlockRef->rotation());
setBlockTableRecord(m_pBlockRef->blockTableRecord());
setBlockTransform(m_pBlockRef->blockTransform());
setNormal(m_pBlockRef->normal());
setPosition(m_pBlockRef->position());
}
But it still doesn't work.
I'm using Visual Studio 2012, AutoCAD 2016, ObjectARX 2016, Windows 7 64bit.
Solved! Go to Solution.