ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

custom entity, how to extend or trim???

11 REPLIES 11
Reply
Message 1 of 12
xuegao007
1164 Views, 11 Replies

custom entity, how to extend or trim???

custom entity, how to extend or trim???

11 REPLIES 11
Message 2 of 12
owenwengerd
in reply to: xuegao007

Derive from AcDbCurve and implement AcDbCurve virtual members.

--
Owen Wengerd
ManuSoft
Message 3 of 12
maisoui
in reply to: owenwengerd

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

 

--
Jonathan
Message 4 of 12
philippe.leefsma
in reply to: maisoui

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.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 5 of 12
maisoui
in reply to: philippe.leefsma

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:

  • Hatch
  • Trim, extend and break methods
  • Grip and snap points need to be all re-implemented instead of inheriting of AcDbCurve

I can't derive from both AcDbCurve and AcDbText. So what can I do?

 

Regards,

Jonathan

 

--
Jonathan
Message 6 of 12
philippe.leefsma
in reply to: maisoui

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.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 7 of 12
maisoui
in reply to: xuegao007

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

 

--
Jonathan
Message 8 of 12
philippe.leefsma
in reply to: maisoui

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



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 9 of 12
maisoui
in reply to: philippe.leefsma

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

 

--
Jonathan
Message 10 of 12
philippe.leefsma
in reply to: maisoui

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.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 11 of 12
maisoui
in reply to: philippe.leefsma

Ok, thank you for your answer. I will try to redefine AutoCAD commands.

Regards,

Jonathan

 

--
Jonathan
Message 12 of 12
zhu_jian_song
in reply to: xuegao007

    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.

Post to forums  

Autodesk Design & Make Report

”Boost