Files
MsAddIns/MstnAPIAssist/Managed/ElementHelper.cpp

52 lines
2.1 KiB
C++
Raw Normal View History

2026-02-28 21:01:57 +08:00
#include "../pch.h"
#include "ElementHelper.h"
#include <vector>
#include <msclr/marshal.h>
#include "../Native/CElementHelper.h"
void BRDI::MstnAPI::ElementHelper::CreateLineElement(GeomNet::DPoint3d startPoint, GeomNet::DPoint3d endPoint)
{
DPoint3dCP pStartPoint = reinterpret_cast<DPoint3dCP>(&startPoint); // GeomNet::DPoint3d<33><64>ֵ<EFBFBD><D6B5><EFBFBD>ͣ<EFBFBD>λ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>̶<EFBFBD><CCB6><EFBFBD>ֱ<EFBFBD><D6B1>ȡ<EFBFBD><C8A1>ַ
DPoint3dCP pEndPoint = reinterpret_cast<DPoint3dCP>(&endPoint);
CElementHelper elemHelper;
elemHelper.CreateLineElement(pStartPoint, pEndPoint);
}
void BRDI::MstnAPI::ElementHelper::CreateLineStringElement(array<GeomNet::DPoint3d>^ points)
{
pin_ptr<GeomNet::DPoint3d> pPoints = &points[0]; // array<GeomNet::DPoint3d>^λ<><CEBB><EFBFBD>йܶѣ<DCB6><D1A3><EFBFBD>Ҫ<EFBFBD>ȹ̶<C8B9>
DPoint3dCP pNativePoint = reinterpret_cast<DPoint3dCP>(pPoints);
int pointCount = points->Length;
CElementHelper elemHelper;
elemHelper.CreateLineStringElement(pNativePoint, pointCount);
}
void BRDI::MstnAPI::ElementHelper::CreateCurveElement(GeomNet::CurveVector^ curveVector)
{
CurveVectorCP pCurveVector = static_cast<CurveVectorCP>(GeomNet::CurveVector::DereferenceToNative(curveVector, false).ToPointer());
CElementHelper elemHelper;
elemHelper.CreateCurveElement(pCurveVector);
}
void BRDI::MstnAPI::ElementHelper::BodyFromLoft(array<GeomNet::CurveVector^>^ profiles, DgnPlatformNET::DgnModelRef^ dgnModelRef)
{
std::vector<CurveVectorPtr> curveVectorPtrs;
for each (GeomNet::CurveVector ^ profile in profiles)
{
CurveVectorPtr pCurveVector = static_cast<CurveVectorP>(GeomNet::CurveVector::DereferenceToNative(profile, false).ToPointer());
curveVectorPtrs.push_back(pCurveVector);
}
int profileCount = profiles->Length;
DgnModelRefP pDgnModelRef = static_cast<DgnModelRefP>(dgnModelRef->GetNative().ToPointer());
CElementHelper elemHelper;
elemHelper.BodyFromLoft(&curveVectorPtrs[0], profileCount, pDgnModelRef);
}
void BRDI::MstnAPI::ElementHelper::ShowMessage(String^ message)
{
msclr::interop::marshal_context context;
WCharCP msg = context.marshal_as<WCharCP>(message);
CElementHelper elemHelper;
elemHelper.ShowMessage(msg);
}