0419test.dgn
Public void GetAttachmentParameter() { DgnFile::LoadedModelsCollection LoadModelCoollect=ISessionMgr::GetActiveDgnFile()->GetLoadedModelsCollection(); for (DgnModelP dgnmodel : LoadModelCoollect) { //得到模型名称 WString name = dgnmodel->GetModelName(); mdlOutput_messageCenter(OutputMessagePriority::Info, name.GetWCharCP(), NULL, DgnPlatform::OutputMessageAlert::Dialog); DgnAttachmentArrayP newAttachmentArrayP = dgnmodel->GetDgnAttachmentsP(); if (NULL != newAttachmentArrayP) { for (DgnAttachmentP attachment : *newAttachmentArrayP) { //得到显示比例 double DisplayScale = attachment->GetDisplayScale(); WString Scale = double_to_WString(DisplayScale); mdlOutput_messageCenter(OutputMessagePriority::Info, Scale.GetWCharCP(), NULL, DgnPlatform::OutputMessageAlert::Dialog); //得到参考原点 DPoint3dCR RefOrigin = attachment->GetRefOrigin(); WString WPoint = Point_WstrPoint(RefOrigin); mdlOutput_messageCenter(OutputMessagePriority::Info, WPoint.GetWCharCP(), NULL, DgnPlatform::OutputMessageAlert::Dialog); //得到主原点 DPoint3d *a = new DPoint3d(); DPoint3dR location = *a; attachment->GetMasterOrigin(location); WString WMOPoint = Point_WstrPoint(location); mdlOutput_messageCenter(OutputMessagePriority::Info, WMOPoint.GetWCharCP(), NULL, DgnPlatform::OutputMessageAlert::Dialog); } } } }
您的问题是什么?
GetRefOrigin得到为-97618.5,3.21039e+06,897626,GetMasterOrigin得到为3751.97,2901.04,0
得到的两个坐标与偏移值不同
仅有一个参考文件不行吧?请把主文件也一起发上来。
---------------------------------------------------------------------------
哦,不需要了。您是在同一个文件中模型间参考的。
参考本文件中的视图文件
您在参考模型时还有一个缩放比例1:1000呢。所以,考虑UOR单位和主单位的关系,界面上X值是这样计算出来的:
① 3751.97 -97618.5/1000 = 3654.3515 该单位为UOR单位
②除以UORPerMaster后就是0.365了