添加项目文件。
This commit is contained in:
55
MstnAPIAssist/Native/CElementHelper.cpp
Normal file
55
MstnAPIAssist/Native/CElementHelper.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#include "../pch.h"
|
||||
#include "CElementHelper.h"
|
||||
#include <Mstn/MdlApi/MdlApi.h>
|
||||
#include <DgnPlatform/DgnPlatformApi.h>
|
||||
#include <Mstn/ISessionMgr.h>
|
||||
#include <PSolid/PSolidCoreAPI.h>
|
||||
#include <cassert>
|
||||
|
||||
USING_NAMESPACE_BENTLEY_DGNPLATFORM
|
||||
USING_NAMESPACE_BENTLEY_MSTNPLATFORM
|
||||
USING_NAMESPACE_BENTLEY_MSTNPLATFORM_ELEMENT
|
||||
|
||||
void CElementHelper::CreateLineElement(DPoint3dCP pStartPoint, DPoint3dCP pEndPoint)
|
||||
{
|
||||
DgnModelRefP pActiveModel = ISessionMgr::GetActiveDgnModelRefP();
|
||||
DSegment3d segment = DSegment3d::From(*pStartPoint, *pEndPoint);
|
||||
EditElementHandle eeh;
|
||||
LineHandler::CreateLineElement(eeh, nullptr, segment, pActiveModel->Is3d(), *pActiveModel);
|
||||
eeh.AddToModel();
|
||||
}
|
||||
|
||||
void CElementHelper::CreateLineStringElement(DPoint3dCP pPoints, int pointCount)
|
||||
{
|
||||
assert(pPoints != nullptr && pointCount >= 2);
|
||||
DgnModelRefP pActiveModel = ISessionMgr::GetActiveDgnModelRefP();
|
||||
EditElementHandle eeh;
|
||||
LineStringHandler::CreateLineStringElement(eeh, nullptr, pPoints, pointCount, pActiveModel->Is3d(), *pActiveModel);
|
||||
eeh.AddToModel();
|
||||
}
|
||||
|
||||
void CElementHelper::CreateCurveElement(CurveVectorCP pCurveVector)
|
||||
{
|
||||
assert(pCurveVector != nullptr);
|
||||
DgnModelRefP pActiveModel = ISessionMgr::GetActiveDgnModelRefP();
|
||||
EditElementHandle eeh;
|
||||
DraftingElementSchema::ToElement(eeh, *pCurveVector, nullptr, pActiveModel->Is3d(), *pActiveModel);
|
||||
eeh.AddToModel();
|
||||
}
|
||||
|
||||
void CElementHelper::BodyFromLoft(CurveVectorPtr* pCurveVectorPtr, int profileCount, DgnModelRefP pDgnModelRef)
|
||||
{
|
||||
assert(pCurveVectorPtr != nullptr && profileCount >= 2);
|
||||
ISolidKernelEntityPtr solidPtr;
|
||||
BentleyStatus status = SolidUtil::Create::BodyFromLoft(solidPtr, pCurveVectorPtr, profileCount, nullptr, 0, *pDgnModelRef);
|
||||
assert(status == SUCCESS && solidPtr.IsValid());
|
||||
|
||||
EditElementHandle eeh;
|
||||
DraftingElementSchema::ToElement(eeh, *solidPtr, nullptr, *pDgnModelRef);
|
||||
eeh.AddToModel();
|
||||
}
|
||||
|
||||
void CElementHelper::ShowMessage(WCharCP message)
|
||||
{
|
||||
mdlDialog_dmsgsPrint(message);
|
||||
}
|
||||
Reference in New Issue
Block a user