添加项目文件。

This commit is contained in:
GG Z
2026-02-28 21:01:57 +08:00
parent 9fe4e5a9aa
commit 7a229067cc
175 changed files with 18060 additions and 0 deletions

View 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);
}

View File

@@ -0,0 +1,13 @@
#pragma once
#include <Mstn/MdlApi/MdlApi.h>
class CElementHelper
{
public:
void CreateLineElement(DPoint3dCP pStartPoint, DPoint3dCP pEndPoint);
void CreateLineStringElement(DPoint3dCP pPoints, int pointCount);
void CreateCurveElement(CurveVectorCP pCurveVector);
void BodyFromLoft(CurveVectorPtr* pCurveVectorPtr, int profileCount, DgnModelRefP pDgnModelRef);
void ShowMessage(WCharCP message);
};