Hi Everyone,
I create myCustomAcDbBlockReference class deriving the AcDbBlockReference in order to add custom snap points to blocks.
I successfully override the osnap protocol methods, but in my objects I loose the AcDbAttribute associated to the Block.
If I insert a block with an AcDbBlockReference I'm able to get all its attributes.
If I insert a block with my own AcDbBlockReference class I have no AcDbAttribute on it.
I lose them!
Should I Implement something in my child class? for example an iterator?
Thank you for your help!
Massimo
AutoCAD's attributes are hard coded to work only with AcDbBlockReference and not with derived classes. Which versions of AutoCAD are you targeting? If only AutoCAD 2010 and later versions, you can use an overrule instead to add your custom snap points.
You need to use the overrule API. Sorry, I don't have an example handy, but you can find plenty of information and even specific examples for adding snap points if you search.
Ok, I looked at the overrules API and it seems the right way,
but
if I add an overrule on the AcDbBlockReference, the overrule will be used for ALL the blockreference added in my drawing?
I seen this example: http://adndevblog.typepad.com/autocad/2012/06/locking-an-entity-in-autocad-using-objectarx.html
Where I have to put my class definition? on the arx or on the dbx project?
Thank you for your help.
Hi,
Here is a blog post on setting up a OSnap overrule for a block reference. The code is in C# but similar method also exist in C++.
http://adndevblog.typepad.com/autocad/2013/06/overruling-osnaps-of-blockreference.html
Hope this helps.
Owen,
>>AutoCAD's attributes are hard coded to work only with AcDbBlockReference
What about the inverse case: can one derive from AcDbAttribute in order to modify its behaviour, and use the custom entity in a regular AcDbBlockReference?
Thanks
alex
@alex_b wrote:What about the inverse case: can one derive from AcDbAttribute in order to modify its behaviour, and use the custom entity in a regular AcDbBlockReference?
I suspect it would work, but I don't know as I've never tried. Even if it works fine in most cases though, I wouldn't be surprised if there were some bugs or unexpected behaviors that result in certain circumstances.
Can't find what you're looking for? Ask the community or share your knowledge.