Skip to content

Commit 3e4a7c3

Browse files
committed
Merge branch 'ado-github-sync' of https://github.com/BentleySystems/MicroStationPython into ado-github-sync
2 parents 2ade02a + 09b79f1 commit 3e4a7c3

7 files changed

Lines changed: 17 additions & 16 deletions

File tree

MSPythonCore/ScriptEngineManager/source/MSPythonEngine.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,8 @@ void PythonScriptEngine::eval_file(WCharCP scriptFile, WCharCP funcName, ScriptC
10671067

10681068
WString function(funcName);
10691069
WString arg;
1070-
localCtx->getAs(L"PyKeyinArg", arg);
1070+
if (!localCtx->getAs(L"PyKeyinArg", arg))
1071+
localCtx->set(L"PyKeyinArg", L"");
10711072
function.append(L" (PyKeyinArg)");
10721073

10731074
mdlErrno = 0;

MSPythonCore/ScriptEngineManager/source/ScriptEngineManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,8 @@ void ScriptEngineManager::ClearException()
476476
+---------------+---------------+---------------+---------------+---------------+------*/
477477
void ScriptEngineManager::InitPySessionInfo()
478478
{
479-
if (nullptr == s_sessionInfo)
480-
s_sessionInfo = new PythonSessionInfo();
479+
static PythonSessionInfo sessionInfo;
480+
s_sessionInfo = &sessionInfo;
481481

482482
s_sessionInfo->ResetPySessionInfo();
483483
}

MSPythonSamples/ReportSample/report_Example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def _load_keyin_commands():
4040
keyinXml = os.path.dirname(__file__) + '/ReportExample.commands.xml'
4141
PythonKeyinManager.GetManager().LoadCommandTableFromXml(WString(__file__), WString(keyinXml))
4242

43-
MessageCenter.ShowInfoMessage(f"Loaded key-in commands. /n REPORTSEXAMPLE CREATE ITEMTYPES /nREPORTSEXAMPLE ATTACH ITEMTYPES /n REPORTSEXAMPLE GENERATE REPORT", "", False)
43+
MessageCenter.ShowInfoMessage(f"Loaded key-in commands. \n REPORTSEXAMPLE CREATE ITEMTYPES \nREPORTSEXAMPLE ATTACH ITEMTYPES \n REPORTSEXAMPLE GENERATE REPORT", "", False)
4444
return True
4545

4646
except Exception as e:

MSPythonTests/MstnPlatformTests/Tests/ChangeTrackCallback_Test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ def test_XAttributeChanged_UndoRedo():
124124

125125
fileLocation = 'MSPython\\MSPythonTests\\PlatformTests\\data\\'
126126
dataDir = getRoot(fileLocation)
127-
doc = DgnDocument.CreateFromFileName ('ChangeTrack.dgn', dataDir, -101, DgnDocument.FetchMode.eWrite)[1]
128-
ISessionMgr.GetManager().SwitchToNewFile(doc[1], '', GraphicsFileType.eGRAPHICSFILE_WildCard, True, True)
127+
status, doc = DgnDocument.CreateFromFileName ('ChangeTrack.dgn', dataDir, -101, DgnDocument.FetchMode.eWrite)
128+
ISessionMgr.GetManager().SwitchToNewFile(doc, '', GraphicsFileType.eGRAPHICSFILE_WildCard, True, True)
129129

130130
ChangeTrackCallback.AddChangedFunction(Changed, file + '.Changed')
131131
ChangeTrackCallback.AddUndoRedoFunction(UndoRedo, file + '.UndoRedo')

MSPythonWrapper/PyBentleyGeom/source/rotmatrix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1476,7 +1476,7 @@ void def_RotMatrix(py::module_& m)
14761476
c1.def("IsEqual", py::overload_cast<RotMatrixCR, double>(&RotMatrix::IsEqual, py::const_), "maxtrix2"_a, "tolerance"_a, DOC(Bentley, Geom, RotMatrix, IsEqual));
14771477

14781478
c1.def("FactorRotateScaleRotate", &RotMatrix::FactorRotateScaleRotate, "rotation1"_a, "scalePoint"_a, "rotation2"_a, DOC(Bentley, Geom, RotMatrix, FactorRotateScaleRotate));
1479-
c1.def("RotateAndSkewFactors", &RotMatrix::RotateAndSkewFactors, "rotation"_a, "skewFactor"_a, "primiaryAxis"_a, "secondaryAxis"_a, DOC(Bentley, Geom, RotMatrix, RotateAndSkewFactors));
1479+
c1.def("RotateAndSkewFactors", &RotMatrix::RotateAndSkewFactors, "rotation"_a, "skewFactor"_a = 0, "primiaryAxis"_a, "secondaryAxis"_a, DOC(Bentley, Geom, RotMatrix, RotateAndSkewFactors));
14801480
c1.def("FactorOrthogonalColumns", &RotMatrix::FactorOrthogonalColumns, "matrixB"_a, "maxtrixV"_a, DOC(Bentley, Geom, RotMatrix, FactorOrthogonalColumns));
14811481

14821482
c1.def("InitTransposedFromQuaternionWXYZ", &RotMatrix::InitTransposedFromQuaternionWXYZ, "wxyzQuat"_a, DOC(Bentley, Geom, RotMatrix, InitTransposedFromQuaternionWXYZ));

MSPythonWrapper/PyMstnPlatform/source/MdlApi/msview.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,7 +1734,7 @@ void def_msview(py::module_& m)
17341734
c10.def_static("updateMulti", [](BoolArray viewDraw, bool incremental, DgnPlatform::DgnDrawMode drawMode,
17351735
DgnModelRefListP modelRefList, bool startEndMsg)
17361736
{
1737-
bool isdraw[DgnPlatform::MAX_VIEWS];
1737+
bool isdraw[DgnPlatform::MAX_VIEWS] = {};
17381738
size_t arrlen = viewDraw.size() > DgnPlatform::MAX_VIEWS ? DgnPlatform::MAX_VIEWS : viewDraw.size();
17391739
for (int i = 0; i < arrlen; i++)
17401740
isdraw[i] = viewDraw[i];
@@ -1745,7 +1745,7 @@ void def_msview(py::module_& m)
17451745
c10.def_static("updateMulti", [](py::list viewDraw, bool incremental, DgnPlatform::DgnDrawMode drawMode,
17461746
DgnModelRefListP modelRefList, bool startEndMsg)
17471747
{
1748-
bool isdraw[DgnPlatform::MAX_VIEWS];
1748+
bool isdraw[DgnPlatform::MAX_VIEWS] = {};
17491749
CONVERT_PYLIST_TO_NEW_CPPARRAY(viewDraw, cppViewDraw, BoolArray, bool);
17501750
size_t arrlen = cppViewDraw.size() > DgnPlatform::MAX_VIEWS ? DgnPlatform::MAX_VIEWS : cppViewDraw.size();
17511751
for (int i = 0; i < arrlen; i++)
@@ -1758,7 +1758,7 @@ void def_msview(py::module_& m)
17581758
c10.def_static("updateMultiEx", [](BoolArray viewDraw, bool incremental, DgnPlatform::DgnDrawMode drawMode,
17591759
DgnModelRefListP modelRefList, bool startEndMsg, bool updateViewTitle)
17601760
{
1761-
bool isdraw[DgnPlatform::MAX_VIEWS];
1761+
bool isdraw[DgnPlatform::MAX_VIEWS] = {};
17621762
size_t arrlen = viewDraw.size() > DgnPlatform::MAX_VIEWS ? DgnPlatform::MAX_VIEWS : viewDraw.size();
17631763
for (int i = 0; i < arrlen; i++)
17641764
isdraw[i] = viewDraw[i];
@@ -1769,7 +1769,7 @@ void def_msview(py::module_& m)
17691769
c10.def_static("updateMultiEx", [](py::list viewDraw, bool incremental, DgnPlatform::DgnDrawMode drawMode,
17701770
DgnModelRefListP modelRefList, bool startEndMsg, bool updateViewTitle)
17711771
{
1772-
bool isdraw[DgnPlatform::MAX_VIEWS];
1772+
bool isdraw[DgnPlatform::MAX_VIEWS] = {};
17731773
CONVERT_PYLIST_TO_NEW_CPPARRAY(viewDraw, cppViewDraw, BoolArray, bool);
17741774
size_t arrlen = cppViewDraw.size() > DgnPlatform::MAX_VIEWS ? DgnPlatform::MAX_VIEWS : cppViewDraw.size();
17751775
for (int i = 0; i < arrlen; i++)
@@ -1835,7 +1835,7 @@ void def_msview(py::module_& m)
18351835
c10.def_static("changeLevelDisplayMask", &mdlView_changeLevelDisplayMask, "modelRef"_a, "iViewNum"_a, "levelMask"_a, "operation"_a, "doUpdate"_a, DOC(mdlView, changeLevelDisplayMask));
18361836
c10.def_static("setLevelDisplayMaskMulti", [](DgnModelRefP modelRef, BoolArray viewList, BitMaskCP viewLevelMask, bool doUpdate)
18371837
{
1838-
bool isdraw[DgnPlatform::MAX_VIEWS];
1838+
bool isdraw[DgnPlatform::MAX_VIEWS] = {};
18391839
size_t arrlen = viewList.size() > DgnPlatform::MAX_VIEWS ? DgnPlatform::MAX_VIEWS : viewList.size();
18401840
for (int i = 0; i < arrlen; i++)
18411841
isdraw[i] = viewList[i];
@@ -1845,7 +1845,7 @@ void def_msview(py::module_& m)
18451845

18461846
c10.def_static("setLevelDisplayMaskMulti", [](DgnModelRefP modelRef, py::list viewList, BitMaskCP viewLevelMask, bool doUpdate)
18471847
{
1848-
bool isdraw[DgnPlatform::MAX_VIEWS];
1848+
bool isdraw[DgnPlatform::MAX_VIEWS] = {};
18491849
CONVERT_PYLIST_TO_NEW_CPPARRAY(viewList, cppViewList, BoolArray, bool);
18501850
size_t arrlen = cppViewList.size() > DgnPlatform::MAX_VIEWS ? DgnPlatform::MAX_VIEWS : cppViewList.size();
18511851
for (int i = 0; i < arrlen; i++)
@@ -1856,7 +1856,7 @@ void def_msview(py::module_& m)
18561856

18571857
c10.def_static("changeLevelDisplayMaskMulti", [](DgnModelRefP modelRef, BoolArray viewList, BitMaskCP levelMask, LevelMaskOperation operation, bool doUpdate)
18581858
{
1859-
bool isdraw[DgnPlatform::MAX_VIEWS];
1859+
bool isdraw[DgnPlatform::MAX_VIEWS] = {};
18601860
size_t arrlen = viewList.size() > DgnPlatform::MAX_VIEWS ? DgnPlatform::MAX_VIEWS : viewList.size();
18611861
for (int i = 0; i < arrlen; i++)
18621862
isdraw[i] = viewList[i];
@@ -1866,7 +1866,7 @@ void def_msview(py::module_& m)
18661866

18671867
c10.def_static("changeLevelDisplayMaskMulti", [](DgnModelRefP modelRef, py::list viewList, BitMaskCP levelMask, LevelMaskOperation operation, bool doUpdate)
18681868
{
1869-
bool isdraw[DgnPlatform::MAX_VIEWS];
1869+
bool isdraw[DgnPlatform::MAX_VIEWS] = {};
18701870
CONVERT_PYLIST_TO_NEW_CPPARRAY(viewList, cppViewList, BoolArray, bool);
18711871
size_t arrlen = cppViewList.size() > DgnPlatform::MAX_VIEWS ? DgnPlatform::MAX_VIEWS : cppViewList.size();
18721872
for (int i = 0; i < arrlen; i++)

PublicAPI/MSPythonCore/ScriptEngineManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ struct UstnScriptNotifier : public ScriptNotifier
238238
public:
239239
virtual void OnException(std::exception& ex) override
240240
{
241-
BeConsole::WPrintf(L"%s\n", ex.what());
241+
BeConsole::WPrintf(L"%ls\n", WString(ex.what()).c_str());
242242
}
243243

244244
virtual void OnError(std::wstring const& msg) override

0 commit comments

Comments
 (0)