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

Custom entity with annotation scaling feature

16 REPLIES 16
Reply
Message 1 of 17
maisoui
1684 Views, 16 Replies

Custom entity with annotation scaling feature

Hi,

 

I like to implement annotation scaling feature (like AcDbText, AcDbHatch, ...) in my custom entities. Does anyone have a solution?

 

Best regards

--
Jonathan
16 REPLIES 16
Message 2 of 17
StephenPreston
in reply to: maisoui

To achieve that we recommend you derive your cystom entity from an AutoCAD entity that already supports annotation scaling. Then you get it for free.

Cheers,

Stephen Preston
Autodesk Developer Network
Message 3 of 17

...There is a sample in the ObjectARX SDK called AnnotationScaling which has a custom entity defined. I wrote it, so please write to me if you have any questions.

 

Fenton Webb

Autodesk Developer Network




Fenton Webb
AutoCAD Engineering
Autodesk

Message 4 of 17
maisoui
in reply to: fenton.webb

Hi,

 

I use your sample to implement annotation scale protocol without deriving from a primitive annotative entity (like AcDbText). Here is what I did:

  • create a custom entity
  • create needed annotation objects deriving from AcDbAnnotativeObjectPE, AcDbObjectContextInterface
  • create a custom ScaleContextData deriving from AcDbObject (to store paper and drawing units)
  • add class protocol extension to my custom entity:

MyCustomEntityAnnotative::desc()->addX(AcDbAnnotativeObjectPE::desc(), new MyAnnotativePE);

MyCustomEntityAnnotative::desc()->addX(AcDbObjectContextInterface::desc(), new MyAnnotativeContextInterface);

 

  • create a custom context menu (deriving from AcEdUIContext) to reproduce AutoCAD 'Annotation Scale Object' context menu

So I only need to derive from my custom entity to have annotation scale protocol. It works but I encountered issues with AutoCAD commands:

  • AIOBJECTSCALE ADD/REMOVE don't seem to recognize my entity and don't edit it
  • OBJECTSCALE seems to deal with my entity but crash without displaying anything

I hope it can help someone. I always try to find a solution to this crash.

Regards.

 

--
Jonathan
Message 5 of 17
fenton.webb
in reply to: maisoui

You mention it works, yet you say it also has problems with AutoCAD commands - currently you cannot derive your own Annotative custom entity because not all of the API is public at this time, that's why it doesn't work. The solution is to derive from Annotative objects, as mentioned before.

 

Sorry for the bad news. If you are ADN member, ask to log a Change Request through the DevHelp online system.

 

Fenton Webb

Autodek Developer Network




Fenton Webb
AutoCAD Engineering
Autodesk

Message 6 of 17
subpartner
in reply to: fenton.webb

Hi,

 

I am doing some tests by deriving from AcDbText (following your example), but it seems that methods 'subGetGripPoints' and 'subMoveGripPointsAt' don't work. I want to overload them... Is there a trick?

 

Best regards,

Jonathan

Message 7 of 17
fenton.webb
in reply to: maisoui

When you say it doesn't work, what do you mean?

 

Thanks
Fenton Webb

Autodesk Developer Network




Fenton Webb
AutoCAD Engineering
Autodesk

Message 8 of 17
subpartner
in reply to: fenton.webb

I found the solution. I need to implement the second version of 'subGetGripPoints' with following args: AcDbGripDataPtrArray & grips, const double curViewUnitSize, const int gripSize, const AcGeVector3d & curViewDir, const int bitflags. Then I return 'Acad::eNotImplementedYet' and it call the first version of subGetGripPoints.

 

My next question is about the specifi context menu for annotative entities (like AcDbText, AcDbHatch, ...), called 'Annotative Object Scale'. Do you know which is the condition used by AutoCAD to determine if this menu will be displayed? My workaround is to create my own AcEdUIContext (exact copy of Annotative Object Scale' one) and to add it to all my custom annotative entities (using acedAddObjectContextMenu).

 

Regards,

Jonathan

Message 9 of 17
renencon
in reply to: fenton.webb

Hi,

 

Is there a way to create scale dependent object properties for a custom annotative object (derived from AcDbText for example)

 

Thanks

Tasos

Message 10 of 17
subpartner
in reply to: renencon

Hi,

 

I'm sorry I didn't understand what your really want. Can you give an example?

 

Otherwise, I noticed another little thing. When a custom entity (inheriting AcDbText) is selected and the properties palette opened, I see that it is written Text in the selection combo box instead of the name of the custom entity. Anyone knows a way to fix that?

 

Best regards,

Jonathan

Message 11 of 17
owenwengerd
in reply to: subpartner

You can handle IOPMPropertyExtension::GetDisplayName() and return a custom name for DISPID 0x0401 (ObjectName property). This is the name AutoCAD displays in the properties window.

--

Owen Wengerd

ManuSoft

 

--
Owen Wengerd
ManuSoft
Message 12 of 17
subpartner
in reply to: owenwengerd

Thanks for your quick reply. I saw this article "Changing the Entity Type name that appears in the OPM window" on the ADN website talking about your solution. But it's necessary to implement COM wrapper and register and... It's a big process only to change the display name of an entity! Moreover, 2013 API OPM methods will change.

 

Is there an easier way?

Message 13 of 17
maisoui
in reply to: subpartner

Hi there,

 

Again a litlle thing about annotative custom object deriving AcDbText : Hatching. I cannot find which method I need to implement to make my custom entity dealing with hatching process. Unlike standard entities, method "subExplode" isn't called and hatch ignore my entity to determine its boudaries.

 

Anyboday have a solution?

 

Regards,

Jonathan

 

--
Jonathan
Message 14 of 17
ChaosInACT
in reply to: fenton.webb


@fenton.webb wrote:

...There is a sample in the ObjectARX SDK called AnnotationScaling which has a custom entity defined. I wrote it, so please write to me if you have any questions.

 

Fenton Webb

Autodesk Developer Network


Really? I'm very interested in this - but I can see no sample like that in the kit? at least by name.... Can you help me with finding it?

 

Thanks!

 

Message 15 of 17

This sample was in ObjectARX SDK 2008 and 2009. You can find and download ObjectARX SDK 2009 from this URL: http://download.autodesk.com/esd/objectarx/2009/ObjectARX_2009_Win_64_and_32Bit.exe

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 16 of 17

lol Thanks! I only checked back 3 years... 😉 

Message 17 of 17

geez thanks again! some great stuff in there....

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost