fix: 水池截面中转文件 JMSJ.sat 按进程隔离,补临时文件命名文档

JMDBDlg、JMSJDlg、HZQTDlg 共 7 处共用固定的 JMSJ.sat,两个 CAD 实例
同时运行时会互相覆盖,acisIn 可能读到另一个实例写的截面。

新增 Pool3dCmd/PoolSectionTemp.h 的 GetPoolSectionSatPath(),文件名改为
JMSJ_<pid>.sat。同一进程内所有调用点路径一致,acisOut 写、ShowLastSection
读的隐式链路不受影响;进程之间用 PID 隔离。顺带去掉无意义的 MakeLower。

同时新增 temp-file-naming.md,记录临时文件命名规则、全库现状,以及
DGJM.sat 已废弃、不再改造的结论。
This commit is contained in:
company-desktop-computer committed 2026-10-22 09:03:11 +08:00
1 parent e3fff2ad66
commit 8caea9e6bd
5 files changed
+86 -17

No files matched your search

+3 -6
View File
@@ -4,6 +4,7 @@
#include "JMSJDlg.h"
#include "GLTKDlg.h"
#include "KTSetting.h"
#include "PoolSectionTemp.h"
DLLIMPEXP CString IDCreate();
@@ -270,9 +271,7 @@ void CHZQTDlg::OnBnClickedCheck1()
CString sScr;
if (dlg.GetCrossSectionScr(sScr))
{
CString sFullPath = FilePath::GetSysDir();
sFullPath.MakeLower();
sFullPath += _T("\\JMSJ.sat");
CString sFullPath = GetPoolSectionSatPath(FilePath::GetSysDir());
CStdioFile file;
if (file.Open(sFullPath,CFile::modeCreate |CFile::modeWrite ))
@@ -394,9 +393,7 @@ void CHZQTDlg::SetFromWall(AcDbObjectId& id)
m_bUserDefSec = TRUE;
pWall->GetSpecialtyData(AcDb::kForRead)->GetAt(KEY_SECTIONSCR,m_sRegScr);
CString sFullPath = FilePath::GetSysDir();
sFullPath.MakeLower();
sFullPath += _T("\\JMSJ.sat");
CString sFullPath = GetPoolSectionSatPath(FilePath::GetSysDir());
CStdioFile file;
if (file.Open(sFullPath,CFile::modeCreate |CFile::modeWrite ))
+3 -4
View File
@@ -3,6 +3,7 @@
#include "JMDBDlg.h"
#include "GLTKDlg.h"
#include "CoreTools.h"
#include "PoolSectionTemp.h"
IMPLEMENT_DYNAMIC(CJMDBDlg, CDialog)
@@ -87,9 +88,7 @@ void CJMDBDlg::OnBnClickedButton1()
CString sScr;
if (dlg.GetCrossSectionScr(sScr))
{
CString sFullPath = FilePath::GetSysDir();
sFullPath.MakeLower();
sFullPath += _T("\\JMSJ.sat");
CString sFullPath = GetPoolSectionSatPath(FilePath::GetSysDir());
CStdioFile file;
if (file.Open(sFullPath,CFile::modeCreate |CFile::modeWrite ))
@@ -173,7 +172,7 @@ void CJMDBDlg::OnBnClickedButton2()
if (m_pSectionReg != NULL && bSuccess)
{
CString sFullPath = FilePath::getSystemTemporaryFolder() + _T("\\JMSJ.sat");
CString sFullPath = GetPoolSectionSatPath(FilePath::getSystemTemporaryFolder());
CString sRegionScrp = _T("");
CString sLine;
+4 -7
View File
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "JMSJDlg.h"
#include "CoreTools.h"
#include "PoolSectionTemp.h"
#include "JUXCDlg.h"
#include "GLTKDlg.h"
#include "BYCDlg.h"
@@ -78,9 +79,7 @@ BOOL CJMSJDlg::OnInitDialog()
void CJMSJDlg::ShowLastSection()
{
//1.截面
CString sFullPath = FilePath::getSystemTemporaryFolder();
sFullPath.MakeLower();
sFullPath += _T("\\JMSJ.sat");
CString sFullPath = GetPoolSectionSatPath(FilePath::getSystemTemporaryFolder());
AcDbVoidPtrArray arBodyPtrs;
if ( Acad::eOk == AcDbBody::acisIn(sFullPath,arBodyPtrs) )
@@ -139,7 +138,7 @@ void CJMSJDlg::OnBnClickedBtaddtodb()
UpdateData(TRUE);
if (!m_curSection.pReg) return;
CString sFullPath = FilePath::getSystemTemporaryFolder() + _T("\\JMSJ.sat");
CString sFullPath = GetPoolSectionSatPath(FilePath::getSystemTemporaryFolder());
CString sRegionScrp = _T("");
CString sLine;
@@ -425,9 +424,7 @@ void CJMSJDlg::OnBnClickedBtselfromdb()
CString sScr,sScrT;
if (dlg.GetCrossSectionScr(sScr))
{
CString sFullPath = FilePath::getSystemTemporaryFolder();
sFullPath.MakeLower();
sFullPath += _T("\\JMSJ.sat");
CString sFullPath = GetPoolSectionSatPath(FilePath::getSystemTemporaryFolder());
CStdioFile file;
if (file.Open(sFullPath,CFile::modeCreate |CFile::modeWrite ))
@@ -0,0 +1,11 @@
#pragma once
// 水池截面 SAT 中转文件路径。
// 同一个 CAD 进程内所有调用点返回同一路径;不同进程用 PID 区分,
// 避免两个实例同时写同一个 JMSJ.sat 互相覆盖。
inline CString GetPoolSectionSatPath(LPCTSTR lpszDir)
{
CString sPath;
sPath.Format(_T("%s\\JMSJ_%lu.sat"), lpszDir, (unsigned long)::GetCurrentProcessId());
return sPath;
}