Derive from AcDbCurve and implement AcDbCurve virtual members.
Hi,
I already derived my custom entity from AcDbText for annotativity protocol. So, is there another way to support TRIM, EXTEND and BREAK commands? It works with AcDbHatch.
Regards,
Jonathan
H Jonathan,
Not all entities can be extended or trimmed. Did you try trimming an AcDbText? This is unlikely that you will be able to do so. As mentionned by Owen, you would need to derive from AcDbCurve in order to achieve that.
Regards,
Philippe.
Hi,
Your teamate told me I need to derive from AcDbText to implement Annotation protocol. Apparently, this is the unique solution to have annotative custom objet, and no API change is envisaged. So, no I have annotative custom object but the downside is a lot of other features don't work:
I can't derive from both AcDbCurve and AcDbText. So what can I do?
Regards,
Jonathan
Yes that's correct, you cannot implement the annotative protocol by yorself, you need to derive from an existing annotative entity. Here they are:
Text, MText, Dimenions, Leaders, Balloons, Tolerance, Tables, Blocks, Attributes, Hatches are the standard built-in annotative entities. If you derive from these built-in annotative entities, you will automatically inherits the scale context framework and will be able to support annotative scales.
I'm affraid that having an annotative curve entity isn't doable because as you mentionned you cannot derive from both classes. One suggestion maybe to embedd an AcDbCurve or custom class derived from it inside your custom entity derived from an annotative class mentionned above. This way you wouldn't really need to reimplement all the grip/snap points as you could simply return the ones of the embedded curve. However this probably won't allow AutoCAD to accept your entity when running trim or extend commands as it is not the right type. You could redefine those commands and perform a type check then invoke some custom code or the native command depending if it is your custom entity or a native curve.
I hope it helps.
Hi,
Thank your for your answer. Can I ask you what is the best way to redifine Acad commands? (reactors or register a custom command with the same name or ...?). I need a independant-language solution because my customers could be french, italian or german.
Regards,
Jonathan
Using reactors won't allow you to replace a native command by your own. Only way to achieve that is to undefine the command and redefine a custom one with the same name. In addition to that there is no language indepedent approach as you need to work with the localized command names, so it's very likely that you would need to either produce language specific dlls or detect the AutoCAD language from your code and act upon.
Here are links that may be useful comcerning undefining/redefining commands:
http://adndevblog.typepad.com/autocad/2012/07/undefining-autocad-commands.html
http://through-the-interface.typepad.com/through_the_interface/2007/03/replacing_the_o.html
Hi,
Thank you for your suggestion. I will explore this solution.
I was wondering if it could be possible to implement a reactor on commandWillStart or commandEnded and when command is TRIM/EXTEND, check if current selection set of entities contains at least one of my custom entity and act like the command for these particular entities. What do you think about this idea? (the big advantage is that it's language independant)
Regards,
Jonathan
One issue with that approach is that when user is starting the command, hence commandWillStart being fired, no entity may have been selected yet, they will be selected only once the command is running.
Ok, thank you for your answer. I will try to redefine AutoCAD commands.
Regards,
Jonathan
virtual Acad::ErrorStatus intersectWith(
const AcDbEntity* ent,
AcDb::Intersect intType,
const AcGePlane& projPlane,
AcGePoint3dArray& points,
int thisGsMarker ,
int otherGsMarker ) const;
.....
custom entity need write by yourself , do not points.append
Can't find what you're looking for? Ask the community or share your knowledge.