Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/OMSimulatorPython/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,19 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/__init__.py"

if(MSVC)
install(FILES OMSimulator.bat TYPE BIN
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ)
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
GROUP_EXECUTE GROUP_READ
WORLD_EXECUTE WORLD_READ)
elseif(MINGW)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/OMSimulator" OMSimulator.bat
TYPE BIN
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ)
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
GROUP_EXECUTE GROUP_READ
WORLD_EXECUTE WORLD_READ)
else()
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/OMSimulator"
TYPE BIN
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ)
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
GROUP_EXECUTE GROUP_READ
WORLD_EXECUTE WORLD_READ)
endif()
13 changes: 13 additions & 0 deletions src/OMSimulatorPython/capi.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class Status(Enum):

class capi:
def __init__(self):
self._suppressPathSet = False
dirname = os.path.dirname(__file__)
## look for dll in the current directory for the python pip package
omslib = os.path.join(dirname, "@OMSIMULATORLIB_STRING@")
Expand Down Expand Up @@ -247,6 +248,18 @@ def setCommandLineOption(self, cmd):
status = self.obj.oms_setCommandLineOption(cmd.encode())
return Status(status)

def setSuppressPath(self, value: bool = True) -> None:
'''Set --suppressPath once per process; the first caller decides.

The native flag parser warns about a flag that is set twice.
'''
if self._suppressPathSet:
return
status = self.setCommandLineOption(f'--suppressPath={str(value).lower()}')
if status != Status.ok:
raise RuntimeError(f'Failed to set --suppressPath: {status}')
self._suppressPathSet = True

def setConnectionLinearTransformation(self, crefA, crefB, factor, offset):
'''Set the linear transformation for a connection between two connectors.
The linear transformation is defined as: output = factor * input + offset.'''
Expand Down
Loading