.NET

Reply
Contributor
ilya.s.solovyev
Posts: 15
Registered: ‎05-01-2012
Message 1 of 3 (313 Views)
Accepted Solution

Get localized type names or all geometry types

313 Views, 2 Replies
07-10-2013 01:11 AM

Is it possible to get localized names for AutoCAD .NET geometry types?

For example, I want to get "Полилиния" (in Russian) for Autodesk.AutoCAD.DatabaseServices.Polyline class.

 

If there is no solution, where can I get a list of all geometry types to translate them into another language programmatically?

1. Those are not geometrical types but entities types.

2. Next code may help you:

[CommandMethod("GetName")]
public static void GetObjName()
{
  Document doc = Application.DocumentManager.MdiActiveDocument;
  Editor ed = doc.Editor;
  PromptEntityResult pres = ed.GetEntity("\nSelect Entity: ");
  if (pres.Status == PromptStatus.OK)
  {
    ed.WriteMessage("\nName: {0}", 
      Autodesk.AutoCAD.Internal.PropertyInspector
      .ObjectPropertyManagerProperties.GetDisplayName(pres.ObjectId));
  }
}

This code can display name of entity identifying with its ObjectId.

Moderator
Alexander.Rivilis
Posts: 1,417
Registered: ‎04-09-2008
Message 2 of 3 (295 Views)

Re: Get localized type names or all geometry types

07-10-2013 06:43 AM in reply to: ilya.s.solovyev

1. Those are not geometrical types but entities types.

2. Next code may help you:

[CommandMethod("GetName")]
public static void GetObjName()
{
  Document doc = Application.DocumentManager.MdiActiveDocument;
  Editor ed = doc.Editor;
  PromptEntityResult pres = ed.GetEntity("\nSelect Entity: ");
  if (pres.Status == PromptStatus.OK)
  {
    ed.WriteMessage("\nName: {0}", 
      Autodesk.AutoCAD.Internal.PropertyInspector
      .ObjectPropertyManagerProperties.GetDisplayName(pres.ObjectId));
  }
}

This code can display name of entity identifying with its ObjectId.


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 3 of 3 (266 Views)

Re: Get localized type names or all geometry types

07-10-2013 01:48 PM in reply to: ilya.s.solovyev

In addition to code above, this will return correct entity type:

Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog(string.Format("Name:\n{0}",pres.ObjectId.ObjectClass.DxfName));

 So if you clicked light polyline, this code return LWPOLYLINE instead of POLYLINE

as per in Alexander's code

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.