hexagon logo

How to develop PC-DMIS in Python?

Tks!
Parents
  • Here's a snippet of some of the simple functions I've written in Python with pywin32 for issues I've run across.
    I'm still pretty new to COM automation, so there's probably a lot that could be done better.
    I've messed around in Ruby a bit as well.

    import win32com.client as w32 
    import re
    import math
    dmisapp = w32.Dispatch('PCDLRN.Application')
    dmispart = dmisapp.ActivePartProgram
    dmiscommands = dmispart.Commands
    
    def delmvpts(dmiscommands):
      type_list =  [150, 162, 60, 61] # 150:MovePoint, 162:MoveAll 60:Tipchng, 61:Loadprobe
      for cmd in dmiscommands:
        if cmd.Type in type_list:
          print(cmd.ID, " deleted.")
          cmd.Remove()
    
    def addxtheo(dmiscommands):
      for cmd in dmiscommands:
        if cmd.IsFeature:
          initx = cmd.GetText(7,0)
          cmd.PutText(str(float(initx) - 80), 7,0) # Shifts theo X by 80mm
          cmd.PutText(str(float(initx) - 80), 22,0)
    
    def namefeexr(dmiscommands):
      for cmd in dmiscommands:
        if cmd.IsFeature:
          if "A167" in cmd.ID:
            cmd.ID = cmd.ID.replace("(.*)L", "\1R") # Changes feature name from left to right.
    
    # delmvpts(dmiscommands)
    # addxtheo(dmiscommands)
    namefeexr(dmiscommands)
  • Now if only I could implement this on a Raspberry Pi...
Reply Children
No Data