Custom Entity Class Name in Property Palette

Custom Entity Class Name in Property Palette

Kyudos
Advisor Advisor
2,620 Views
18 Replies
Message 1 of 19

Custom Entity Class Name in Property Palette

Kyudos
Advisor
Advisor

I have a custom object derived from AcDbBlockReference. In the property palette of AutoCAD 2016, and the Quick Select dialog, my objects only show up as their base class type. Obviously, I want them to show with the class name / object type I've given them.

 

(I have the same issue with other custom entities derived from AcDbPolyline)

 

I'm hoping I've just forgotten to implement a macro or something (each object implements ACRX_DXF_DEFINE_MEMBERS, for example).

 

Any ideas?

0 Likes
Accepted solutions (2)
2,621 Views
18 Replies
Replies (18)
Message 2 of 19

Kyudos
Advisor
Advisor

A bit more digging...

 

Do I really have to do this:

 

http://forums.autodesk.com/t5/objectarx/how-to-create-custom-entity-with-its-name-in-properties-pale...

 

The object type/class name is an intrinsic part of any custom object - why is it's name not automatically exposed? 

0 Likes
Message 3 of 19

Kyudos
Advisor
Advisor

Additionally...is this why my CUIX defined Double Click Actions don't work? Because my custom entities are not intrinsically identified as the correct type?

 

 

0 Likes
Message 4 of 19

Alexander.Rivilis
Mentor
Mentor

Changing the Entity Type name that appears in the OPM window

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | 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

0 Likes
Message 5 of 19

Kyudos
Advisor
Advisor

Hi Alexander,

 

I see what is (seemingly) required to change the displayed name. But my subsequent question still stands - is this really necessary? (I'm guessing yes).

 

There are several API functions that can (and do) correctly identify the type of my custom object (LIST command for example). I shouldn't be forced to implement a whole COM properties interface to get this to work - especially if it is just for a single property.

 

It is especially troubling if I have to do the COM thing in order to get basic functionality to work (like double-clicking on my custom objects).

 

It would seem to me to be inconsistent - most commands and API seem to be able to correctly type my objects, but not the property panel?

I could understand overriding GetDisplayName to show something different, but surely the default implementation should show the actual type of the object?

0 Likes
Message 6 of 19

Alexander.Rivilis
Mentor
Mentor

I do not see any reason to continue the discussion. You have already explained how to do it PROPERLY. You must decide whether you will do so or not.

 

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | 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

0 Likes
Message 7 of 19

Alexander.Rivilis
Mentor
Mentor

P.S.: In order to select custom entity in QSELECT command COM-wrapper for this entity is also required:

 

2016-08-05_11-35-53.png

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | 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

0 Likes
Message 8 of 19

Kyudos
Advisor
Advisor

Hi Alexander,

 

If you feel this discussion has run it's course, that's OK, but I still think it needs addressing by someone from AutoDesk. Never in my development career, now approaching 20 years, have I found myself thinking "I can't believe it actually works like that" on a practically weekly basis. I mean that quite literally - ObjectArx is such a large API and I'm still getting familiar with it, so often I can't believe I have found the correct solution, I'm sure there must be a better, easier way to do things.

 

Unfortunately, I'm yet to be pleasantly surprised by AutoCAD.

 

In other situations, I'm prepared (eventually) to just say, "OK, It's dumb, but let's just do it the AutoCAD way", but in this case I think this really needs to be fixed.

 

This is how it appears to me (naive as I may be):

 

  • Several basic CAD functions depend on AutoCAD being able to identify the type of objects in a DWG.
  • There exist functions that can unambiguously identify the type of all objects.
  • There also exists a complicated COM implementation that may or may not identify the type of an object based on what it was derived from and whether or not it implements a supposedly optional interface.
  • For reasons best known to themselves, AutoCAD have apparently made basic functionality depend on the inconsistent COM way of identifying things.

 

That's not just an obtuse way of doing things - it's wrong, a bug. I mean, what happens on a non-COM platform like Mac? Do they just have to put up with this stuff not working? (and yes I checked - as far as I can tell, you can't change the class name using the non-COM properties interface)

0 Likes
Message 9 of 19

Virupaksha_aithal
Autodesk Support
Autodesk Support
Accepted solution

Hi,

 

As Alexander mentioned, you need use COM to provide property Palette interface for your entity. From AutoCAD 2013, there is non-COM API for property Palette interface, refer http://adndevblog.typepad.com/autocad/2012/04/devtv-non-com-property-system.html . But this is very basic and has not exposed all the required API. So, still the best way is to use COM.



Virupaksha Aithal KM
Developer Technical Services
Autodesk Developer Network

Message 10 of 19

Kyudos
Advisor
Advisor

Hi Virupaksha,

 

Thanks for your response. To be perfectly honest, I'm not too bothered about the property panel - it is a bit of a pain but I can probably live with it.

 

What really concerns me the possibility that other functions won't work because my object is not identified as the correct type. Can you tell me, for instance, is this the reason my CUIX defined double-click actions for my custom classes don't work?

 

What other functions depend on a class-type identification from the COM system?

0 Likes
Message 11 of 19

Virupaksha_aithal
Autodesk Support
Autodesk Support

Hi,

 

double click action is not related to COM object defining for the custom entity.

 

double click action depends on :

Having CUI entry for double click

Giving correct DXF name of the entity in double click action

associating required command for double click in CUI.

 

refer attached sample project, where a custom entity is defined. Please load the partial cui contained in the zip file in AutoCAD. Use command "MyCommandLocal" to create the custom entity. double click of the entity shows a alert dialog.

 

 

 

 



Virupaksha Aithal KM
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 12 of 19

Kyudos
Advisor
Advisor

Aha!

 

Thanks...that solves my Double-Click issue. In my ACRX_DXF_DEFINE_MEMBERS macro I had my DXF Name as MyObject, but in my CUIX I had MYOBJECT.

 

It seems AutoCAD makes a case sensitive comparison somewhere along the line - may I suggest that MyObject should be equivalent to MYOBJECT in this situation? (should DXF names always be uppercase?)

 

However, as noted above, QSELECT seems to depend on the COM identification system. Given that FILTER doesn't appear to work with custom objects, does that mean there is no way to filter-select my objects without implementing COM properties?

0 Likes
Message 13 of 19

Virupaksha_aithal
Autodesk Support
Autodesk Support
Accepted solution

Hi,

 

Qselect works with non-com property system. But as i said, it depends on kind of properties you have in your custom entity. Please refer http://adndevblog.typepad.com/autocad/2012/04/devtv-non-com-property-system.html which has a simple sample.

But to have all kind of property support, you need to depend on COM



Virupaksha Aithal KM
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 14 of 19

Kyudos
Advisor
Advisor

Ok - thanks again, still not possible I guess. I have already test out the non-COM property system. But if I have to add COM support and implement COM methods anyway, to support GetDisplayName, I may as well use the COM system for everything (I was trying to avoid this).

 

I do note, in the comments section at that link:

 

 


Balaji said...

Hi Dan,

 

Sorry, this is not possible at present using the Non-COM property system.
We have a request logged with our engineering team for this.


 

That was three years ago.

 

Surely it isn't that hard?

 

PSEUDO CODE::

const ACHAR* sDisplayName;
AcDbObject* pObj = NULL;
acdbTransactionManager->getObject(pObj, id, mode);

if (pObj != NULL)
{
    sDisplayName = pObj->isA()->name();
}

if (Supports COM && has GetDisplayName func)
{
    // COM Override
    sDisplayName = GetCOMName();
}

 

0 Likes
Message 15 of 19

Alexander.Rivilis
Mentor
Mentor

Kyudos

I think it is wrong and very annoying practice to mark all his posts as a Solution.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | 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

0 Likes
Message 16 of 19

Kyudos
Advisor
Advisor

In what way?  It's my thread, and my question. Don't I get to decide when I have received a satisfactory answer? Even if it is my own?

0 Likes
Message 17 of 19

Alexander.Rivilis
Mentor
Mentor

@Kyudos wrote:

In what way?  It's my thread, and my question. Don't I get to decide when I have received a satisfactory answer? Even if it is my own?


🙂 There is no your's or not your's thread. Answer marked as solution have to be right. In this topic right answer is: "There is impossible to set Custom Entity name in OPM windows without COM wrapper for Custom Entity".

 

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | 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

0 Likes
Message 18 of 19

Kyudos
Advisor
Advisor

Fair enough. Can I ask a question of you, as a Moderator? If I make a post for the information of other members, where I don't really require a "solution", should I accept my own post a solution? Or should I just leave it 'unanswered'?

0 Likes
Message 19 of 19

Alexander.Rivilis
Mentor
Mentor

I am not a moderator of this forum. Therefore, my opinion may be not true. I think if you find solution yourself (without tips of other users) - you can post yours full answer and mark it as Solution.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | 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

0 Likes