I wanted to open a thread for only this issue. There is some simple, but cool stuff I'd like to do if I could simply pass a variable to and from PCDMIS and Python.
I'd prefer not having to use a notepad temporary txt file that is the workaround for passing variables.
Below is the code in python that seems like the correct syntax to pass the variables, but it isn't working. You're my hero if you have the solution ;)
import win32com.client as w32 # Connect to PCDMIS dmisapp = w32.Dispatch('PCDLRN.Application') dmispart = dmisapp.ActivePartProgram # Retrieve the value of the variable "SHORTLOT" # The VBA script to do this would be the following syntax: # Dim Var As Object # Set Var = dmispart.GetVariableValue ("SHORTLOT") # The python syntax similar to the above approach does not work: short_lot_value = dmispart.GetVariableValue("SHORTLOT") # Set the value of the variable "SHORTLOT" # The VBA Script to do this is: # dmispart.SetVariableValue "SHORTLOT", short_lot_value # The python method would seem to be this but doesn't work: short_lot_value = "LOT-123456" dmispart.SetVariableValue("SHORTLOT", short_lot_value)