GetCADLayerNameByID メソッド

構文

BSTR GetCADLayerNameByID(LONG u);

CADレイヤ名を取得します。

パラメータ

u
名前を取得したいレイヤのIDを指定します。

使用例

// C++ sample
// 間取りオブジェクトへ接続
CMadoriDoc * m_MadoriDoc = new CMadoriDoc();
CLSIDFromProgID (L"MyHomeDesignerMadori.MadoriDoc", &clsid);
GetActiveObject (clsid, NULL, &pUnk);
pUnk->QueryInterface (IID_IDispatch, (void**)(&pDisp));
m_MadoriDoc->AttachDispatch (pDisp);

// 下絵読み込み
if(!m_MadoriDoc->CADDataOpen(L"C:\\Users\\Public\\Documents\\aaa.dxf", 1.0)){
	// エラー
	return;
}

// レイヤ数を確認
USHORT uNum = m_MadoriDoc->GetCADLayerNum();

for(USHORT u = 0; u < uNum; ++u){
	UINT nLayerID = m_MadoriDoc->GetCADLayerID(u);
	BSTR bstr = m_MadoriDoc->GetCADLayerNameByID(nLayerID);
	// 何か処理
	// ...
	
	// 解放
	::SysFreeString(bstr);
}
// JavaScript sample
var doc = new CMadoriDoc();
var num = doc.GetCADLayerNum();
alert(num);
var u;
for(u=0; u < num; ++u){
	var layerID = doc.GetCADLayerID(u);
	var layerName = doc.GetCADLayerNameByID(layerID);
	alert(layerName);
}