Message 1 of 5
recreating AcDbBlockReference functionality
Not applicable
09-22-2002
02:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
OK, heres my story.....
Im currently working on a fire protection design application; its basically just an overgrown dimension. The main part is, CPsDbSprinklerLine derived from AcDbEntity, which is displayed as a line with text above and below, then, at the end of the line I would like to display an instance of an AcDbBlockTableRecord. But Im having a bit of trouble figuring out to best way to display an instance of said, AcDbBlockTableRecord.
Its kind of set up like this (logically not technically)...............
class CPsDbSprinklerLine : public AcDbEntity
{
.....etc....
AcGePoint3d m_pt3dStart; <---- used as block position
AcGePoint3d m_pt3dEnd;
AcDbHardPointerId m_objIdBlockRecord;
double m_dBlockScaleX;
double m_dBlockScaleY;
double m_dBlockScaleZ;
double m_dBlockRotation;
............etc......
};
I guess Im just looking for and explanation of how, exactly, the AcDbBlockReference works. Im thinking that I need to write, CPsDbSprinklerLine::BlockTransform() that returns the same type of AcGeMatrix3d as the AcDbBlockReference.
The implementation of CPsDbSprinklerLine::worldDraw(AcGiWorldDraw* mode) would be along the lines of............
for each AcDbEntity located within CPsDbSprinklerLine ::m_objIdBlockRecord
{
clone the AcDbEntity;
apply AcGeMatrix3d returned from CPsDbSprinklerLine::BlockTransform();
call AcDbEntity::worldDraw(mode);
delete previously cloned AcDbEntity;
};
draw other necessary components........
This does not sound at all correct though, it seems very sloppy. If it was me, I would have a function written into AcDbBlockTableRecord to display itself transformed by a given AcGeMatrix3d. I looked for such a function but couldnt find anything like it, I also couldnt find any implementation details of AcDbBlockReference either.
Another problem Im having is trying to find some function in ObjectArx/Dbx that will let me tell AutoCAD to search for a file within the realms of its support path directories. I looked at AcDbHostApplicationServices::findFile() but it is pure virtual and its not even close.
Im again basically trying to recreate the AcDbBlockReference and INSERT functionality; when the user asks to put a block on the end of the CPsDbSprinklerLine that is not loaded into the current AcDbBlockTable, I would like to search through the AutoCAD support directories for the requested block, exactly the same way INSERT does. I would like to try to avoid using acedCommand() because Im not actually going to be creating any instance of AcDbBlockReference, the AcDbBlockTableRecord is kept from being purged with CPsDbSprinklerLine::m_objIdBlockRecord.
Pre-Thanks to anyone who could give any helpful information, your time is much appreciated.
Im currently working on a fire protection design application; its basically just an overgrown dimension. The main part is, CPsDbSprinklerLine derived from AcDbEntity, which is displayed as a line with text above and below, then, at the end of the line I would like to display an instance of an AcDbBlockTableRecord. But Im having a bit of trouble figuring out to best way to display an instance of said, AcDbBlockTableRecord.
Its kind of set up like this (logically not technically)...............
class CPsDbSprinklerLine : public AcDbEntity
{
.....etc....
AcGePoint3d m_pt3dStart; <---- used as block position
AcGePoint3d m_pt3dEnd;
AcDbHardPointerId m_objIdBlockRecord;
double m_dBlockScaleX;
double m_dBlockScaleY;
double m_dBlockScaleZ;
double m_dBlockRotation;
............etc......
};
I guess Im just looking for and explanation of how, exactly, the AcDbBlockReference works. Im thinking that I need to write, CPsDbSprinklerLine::BlockTransform() that returns the same type of AcGeMatrix3d as the AcDbBlockReference.
The implementation of CPsDbSprinklerLine::worldDraw(AcGiWorldDraw* mode) would be along the lines of............
for each AcDbEntity located within CPsDbSprinklerLine ::m_objIdBlockRecord
{
clone the AcDbEntity;
apply AcGeMatrix3d returned from CPsDbSprinklerLine::BlockTransform();
call AcDbEntity::worldDraw(mode);
delete previously cloned AcDbEntity;
};
draw other necessary components........
This does not sound at all correct though, it seems very sloppy. If it was me, I would have a function written into AcDbBlockTableRecord to display itself transformed by a given AcGeMatrix3d. I looked for such a function but couldnt find anything like it, I also couldnt find any implementation details of AcDbBlockReference either.
Another problem Im having is trying to find some function in ObjectArx/Dbx that will let me tell AutoCAD to search for a file within the realms of its support path directories. I looked at AcDbHostApplicationServices::findFile() but it is pure virtual and its not even close.
Im again basically trying to recreate the AcDbBlockReference and INSERT functionality; when the user asks to put a block on the end of the CPsDbSprinklerLine that is not loaded into the current AcDbBlockTable, I would like to search through the AutoCAD support directories for the requested block, exactly the same way INSERT does. I would like to try to avoid using acedCommand() because Im not actually going to be creating any instance of AcDbBlockReference, the AcDbBlockTableRecord is kept from being purged with CPsDbSprinklerLine::m_objIdBlockRecord.
Pre-Thanks to anyone who could give any helpful information, your time is much appreciated.