CommandCreatedEventHandlerで
Ptr<SelectionCommandInput> selectionStitchFacesInput = inputs->itemById("MoldStitchFacesInput");
if (!selectionStitchFacesInput)
{
selectionStitchFacesInput = inputs->addSelectionInput("MoldStitchFacesInput", u8"パーティング面", u8"パーティング面(複数)を選択します。");
if (!selectionStitchFacesInput)
return;
selectionStitchFacesInput->isFullWidth(false);
selectionStitchFacesInput->addSelectionFilter("SurfaceBodies");
selectionStitchFacesInput->setSelectionLimits(0);
}
とselectionStitchFacesInputを生成しています
InputChangedEventHandlerで
Ptr<BRepBodies> bodies = occ->component()->bRepBodies();
if (!bodies)
return;
// サーフェスボディを読み取り
if ( bodies->count() )
{
Ptr<SelectionCommandInput> selectionInput = inputs->itemById("MoldStitchFacesInput");
if (!selectionInput)
return;
for (size_t i = 0; i < bodies->count(); i++)
{
Ptr<BRepBody> body = bodies->item(i);
if (body)
{
if (!selectionInput->addSelection(body))
{
checkLastError();
return;
}
}
}
}
とselectionInput->addSelection(body))部分でコンポーネントに登録されているBodyを指定するとエラーとなります。
エラーの内容は
「invalid argument selection」となっています。
ここのBRepBodyはSurfaceBodyです。
InputChangedEventHandlerの内部ではaddSelection()は使用できないのでしょうか?