.NET

.NET

Reply
Contributor
15 Posts
0 Kudos
Registered: ‎05-01-2012
Post 1 of 3
Accepted Solution

Get localized type names or all geometry types

375 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
1,465 Posts
277 Kudos
Registered: ‎04-09-2008
Post 2 of 3

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*
1,569 Posts
171 Kudos
Registered: ‎10-08-2008
Post 3 of 3

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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!