.NET

.NET

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

Get localized type names or all geometry types

370 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,458
Registered: ‎04-09-2008
Message 2 of 3 (352 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 (323 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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.