objectarx:ブロック名は英数は大文字になる

objectarxで、ブロックの名称で何やら違った動作に
ブロック名称に例えば
autocad上で”mm管”は、”mm管”の名前だが
objectarxで”mm管” と作成してあるブロックは
拡張オブジェクトの”mm管”は名前を取得すると”MM管”となる
覚えていたほうが良いかも知れない。
日本語の2バイト文字は明確に表示されるが英文字は、大文字になるので
属性名が合致しない。

//ブロックのみに限定
if ((tr.GetObject(btrId, OpenMode.ForRead).GetType().FullName.Equals(“Autodesk.AutoCAD.DatabaseServices.BlockReference”)))
{
try
{
BlockReference btr = (BlockReference)tr.GetObject(btrId, OpenMode.ForRead);
//オブジェクトの状態
Entity ent = tr.GetObject(btrId, OpenMode.ForRead) as Entity;
OHandle = btrId.Handle;
OID = btrId;
//基本画層名
layername = btr.Layer.ToString();
//ブロックの位置を取得
pol = btr.Position;
Rotation = btr.Rotation.ToString();
if (ent != null)
{
BlockReference br = ent as BlockReference;
if (br != null)
{
BlockTableRecord bd = (BlockTableRecord)tr.GetObject(br.BlockTableRecord, OpenMode.ForRead);

// … to see whether it’s a block with
// the name we’re after
switch (blockName)
このブロック名がmmなどの英文字は、大文字になる。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です