C++ named boundary

老师我这里创建named boundary  每次都会崩溃.这个根据shap单个创建named boundary 有什么问题吗?还是我创建的方式不对

void create_nameboundary111(Transform* transform)
{
MSElementP el;
MSElement el1;
DPoint3d pts[4];
NamedBoundaryPtr namedptr;

EditElementHandle eehShape;
ElementHandle eehShape1;
WStringP namegroup = new WString(L"namerdgroup");
DgnModelR modelR = *ISessionMgr::GetActiveDgnModelP();
/*named boundary 集合*/
NamedBoundaryGroupPtr boundarygrop = NamedBoundaryGroup::Create(modelR, *namegroup, *namegroup);

pts[0].x = 1000* g_1mu;
pts[0].y = 0* g_1mu;

pts[1].x = 8000* g_1mu;
pts[1].y = 0* g_1mu;

pts[3].x = 8000* g_1mu;
pts[3].y = 7000* g_1mu;

pts[2].x = 1000* g_1mu;
pts[2].y = 7000* g_1mu;


if (SUCCESS == ShapeHandler::CreateShapeElement(eehShape, NULL, pts, 4, ACTIVEMODEL->Is3d(), *ACTIVEMODEL))
{

el = eehShape.GetElementP();
mdlElement_transform(&el1, el, transform);
//eehShape
eehShape.ReplaceElement(&el1);
eehShape.AddToModel();
/*创建namedboundary 加入named boundary group*/

//namedptr = NamedBoundary::Create(eehShape/*元素*/);创建出来的named boundary 一直为空 

NamedBoundary* newBoundaryx = new NamedBoundary();

newBoundaryx->SetGraphicalElement(eehShape);

newBoundaryx->SetName(L"name");
boundarygrop->InsertBoundary(newBoundaryx);
boundarygrop->WriteToFile();

}

}

Parents Reply Children
No Data