hexagon logo

python development instances for pc-dmis.

import win32com.client as w32
dmisapp = w32.Dispatch('PCDLRN.Application')
dmispart = dmisapp.ActivePartProgram
dmiscommands = dmispart.Commands

def pc_dmis_report():
    for cmd in dmiscommands:
        if cmd.IsDimension and int(cmd.DimensionCommand.OutTol)==0:
            cmd.SetToggleString(3,165,0)
        else:
            cmd.SetToggleString(4,165,0)

pc_dmis_report()
dmispart.RefreshPart()
Parents
  • No luck with python 3.5 either. This could be user privilege or just a Windows 10 security again.
    Also, as you stated that this could be an install issue on my part.


    Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:38:48) [MSC v.1900 32 bit (Intel)] on win32
    Type "copyright", "credits" or "license()" for more information.
    >>>
    RESTART: C:\Users\davehocum\AppData\Local\Programs\Python\P ython35-32\PC-DMIS_Test1.py
    Traceback (most recent call last):
    File "C:\Users\davehocum\AppData\Local\Programs\Python\ Python35-32\lib\site-packages\win32com\client\dynamic.py", line 89, in _GetGoodDispatch
    IDispatch = pythoncom.connect(IDispatch)
    pywintypes.com_error: (-2147221021, 'Operation unavailable', None, None)
    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
    File "C:\Users\davehocum\AppData\Local\Programs\Python\ Python35-32\PC-DMIS_Test1.py", line 2, in <module>
    dmisapp = w32.Dispatch('PCDLRN.Application')
    File "C:\Users\davehocum\AppData\Local\Programs\Python\ Python35-32\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
    dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userN ame,clsctx)
    File "C:\Users\davehocum\AppData\Local\Programs\Python\ Python35-32\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
    File "C:\Users\davehocum\AppData\Local\Programs\Python\ Python35-32\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
    pywintypes.com_error: (-2146959355, 'Server execution failed', None, None)
    >>>
Reply
  • No luck with python 3.5 either. This could be user privilege or just a Windows 10 security again.
    Also, as you stated that this could be an install issue on my part.


    Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:38:48) [MSC v.1900 32 bit (Intel)] on win32
    Type "copyright", "credits" or "license()" for more information.
    >>>
    RESTART: C:\Users\davehocum\AppData\Local\Programs\Python\P ython35-32\PC-DMIS_Test1.py
    Traceback (most recent call last):
    File "C:\Users\davehocum\AppData\Local\Programs\Python\ Python35-32\lib\site-packages\win32com\client\dynamic.py", line 89, in _GetGoodDispatch
    IDispatch = pythoncom.connect(IDispatch)
    pywintypes.com_error: (-2147221021, 'Operation unavailable', None, None)
    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
    File "C:\Users\davehocum\AppData\Local\Programs\Python\ Python35-32\PC-DMIS_Test1.py", line 2, in <module>
    dmisapp = w32.Dispatch('PCDLRN.Application')
    File "C:\Users\davehocum\AppData\Local\Programs\Python\ Python35-32\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
    dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userN ame,clsctx)
    File "C:\Users\davehocum\AppData\Local\Programs\Python\ Python35-32\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
    File "C:\Users\davehocum\AppData\Local\Programs\Python\ Python35-32\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
    pywintypes.com_error: (-2146959355, 'Server execution failed', None, None)
    >>>
Children
No Data