Custom Imput Window

Started by Admin, April 12, 2012, 08:31:18 AM

Previous topic - Next topic

Admin

I'm looking to create a custom input window something like this:

Device - [Dropdown with 3 devices]
Option 1 - [Radio Button Yes] [Radio Button No]
Option 2 - [Radio Button Yes] [Radio Button No]
Option 3 - [Radio Button Yes] [Radio Button No]

Would I have to use a VB script for this?

jrayself

Jason R. Self
Dimensional Engineering, Inc.

Admin

Looked promising, but it is only 32-bit///

Quote
Can I use ONCommand with 64bit?
By now(ver 1.00) the ONCommand PlugIn is only offered for 32bit.

jrayself

Ouch. His source code is available, perhaps you could recompile it in a 64bit environment?
Jason R. Self
Dimensional Engineering, Inc.

jason25

How partial are you to using radios?  I could do something with a dialogue box where you would enter either 1 or 0.  If interested, let me know which devices to add to the list. Would you want to just select the device or select and connect?

jason25


Admin

I've tried the 1 or 0 thing, but the dropdown or radio option would make it much cleaner with a lot of options.

jason25

I agree, I have been hoping that there would be some radio and dropdown options coming.  I have only been using PW for about a 18 months and that is my only gripe.  With all of the other capabilities, I'm very pleased.  Let me know if you would like the code for this.

jrayself

I would be interested in seeing how you pulled that off. I have a couple ideas in mind that I could use it for.
Jason R. Self
Dimensional Engineering, Inc.

jason25

Not a problem, I'll post it when I get back to work tomorrow.

Admin

Are you referring to the multiple parameter input?

One nice thing to do in the multiple parameter input (with 1 or 0) as the desired output, is to use a loop to check that all outputs are either 1 or 0.

Quoteversion "5.0"
#======================================================
# ---- InnovMetric Software Inc.
# ---- Module  :    Workspace Manager
# ---- Version :    12.0.8 ( 12.00.08.4688 )
# ---- Date    :    Wednesday, June 06, 2012 - 16:04:01
#------------------------------------------------------

DECLARE vA
DECLARE vB
DECLARE vC
DECLARE vX
DECLARE vY
DECLARE vZ
DECLARE vL
DECLARE vM
DECLARE vN
DECLARE vString

MACRO INPUT MULTIPLE_PARAMETERS("Window Title", \
    "Main Prompt String", \
    {"INTEGER", "A-Prompt", 0, \
    "INTEGER", "B-Prompt", 0, \
    "INTEGER", "C-Prompt", 0, \
    "INTEGER", "X-Prompt", 0, \
    "INTEGER", "Y-Prompt", 0, \
    "INTEGER", "Z-Prompt", 0, \
    "DOUBLE", "L-Prompt", 0, \
    "DOUBLE", "M-Prompt", 0, \
    "DOUBLE", "N-Prompt", 0, \
    "STRING", "String-Prompt", 0}, \
    vA, vB, vC, vX, vY, vZ, vL, vM, vN, vString)

In this case I only care that variable A, B, C, X, Y, Z are 0 or 1, so I'll setup a loop around the input to check that.

jason25

Here is what I did with it.  I didn't do a loop to check that the value is 0 or 1, but am doing a check to see that only 1 device is selected.
version "5.0"
#====================================================
# ---- InnovMetric Software Inc.
# ---- Module  :    IMInspect
# ---- Version :    12.0.8 ( 12.00.08.4687 )
# ---- Date    :    Tuesday, June 05, 2012 - 07:29:29
#----------------------------------------------------
DECLARE device_a "Faro Arm"
DECLARE device_a_use
DECLARE device_b "CimCore Arm"
DECLARE device_b_use
DECLARE device_c "PolyWorks Probe Simulator"
DECLARE device_c_use
DECLARE macro_error

MACRO INPUT MULTIPLE_PARAMETERS("Device Selection", "Select a device to use:", {"integer", "  $device_a (0/1)", $device_a_use, "integer", "  $device_b (0/1):", $device_b_use, "integer", "  $device_c (0/1):", $device_c_use}, device_a_use, device_b_use, device_c_use)

MACRO GET_ERROR_STATUS(macro_error)
IF $macro_error == "Error"
    MACRO PAUSE ("Cancel", "Selection Cancelled.")
    MACRO END
ENDIF

IF EXPR_I($device_a_use + $device_b_use + $device_c_use) >= 2
    MACRO PAUSE ("Error.", "Select only 1 Device.")
    MACRO END
ENDIF

IF $device_a_use == 1
    PROBE DEVICE($device_a)
    PROBE DEVICE CONNECT ( "On" )
    MACRO GET_ERROR_STATUS(macro_error)
    IF $macro_error == "Error"
        MACRO PAUSE ("Error", "Could not connect to $device_a.")
    ENDIF
ENDIF

IF $device_b_use == 1
    PROBE DEVICE($device_b)
    PROBE DEVICE CONNECT ( "On" )
    MACRO GET_ERROR_STATUS(macro_error)
    IF $macro_error == "Error"
        MACRO PAUSE ("Error", "Could not connect to $device_b.")
    ENDIF
ENDIF

IF $device_c_use == 1
    PROBE DEVICE($device_c)
    PROBE DEVICE CONNECT ( "On" )
    MACRO GET_ERROR_STATUS(macro_error)
    IF $macro_error == "Error"
        MACRO PAUSE ("Error", "Could not connect to $device_c.")
    ENDIF
ENDIF