PointCloud.us - A PolyWorks Support Forum

PolyWorks Discussion => Macro World => Topic started by: jrayself on June 03, 2010, 08:32:09 AM

Title: Laser Tracker Macros
Post by: jrayself on June 03, 2010, 08:32:09 AM
Has anyone out there written any Laser Tracker specific macro scripts?
Title: Re: Laser Tracker Macros
Post by: Admin on September 08, 2010, 07:00:58 AM
No experience with laser trackers here.
Title: Re: Laser Tracker Macros
Post by: jrayself on March 22, 2011, 05:32:43 AM
This macro will get the XYZ coordinates of a selected point feature in the tree views and aim the measurement device (laser tracker) to it.

version "4.0"

MACRO END_ON_ERROR ( "On" )

DECLARE i 1
DECLARE nb_selected 0
DECLARE nb_features 0
DECLARE status "Off"
DECLARE index 0
DECLARE contents
DECLARE x
DECLARE y
DECLARE z

TREEVIEW FEATURE GET_NB_SELECTED ( nb_selected )
IF $nb_selected != 1
    MACRO END
ENDIF

TREEVIEW FEATURE GET_NB ( nb_features )

WHILE $i <= $nb_features
    TREEVIEW FEATURE GET_SELECTION_STATUS ( $i, status )
    IF $status == "On"
        IF $index == 0
            SET index $i
            SET i $nb_features
        ENDIF
    ENDIF
    ++ i
ENDWHILE

TREEVIEW FEATURE PROPERTIES CONTENTS GET ( contents )

IF $contents == "Empty"
    MACRO END
ENDIF

IF $contents == "Measured"
    TREEVIEW FEATURE MEASURED SELECT ( $index, "On"  )
    TREEVIEW PRIMITIVE POINT PROPERTIES POINT GET (x,y,z)
    PROBE DEVICE GO_XYZ ( $x,$y,$z)
    TREEVIEW FEATURE COLLAPSE
ENDIF

IF $contents == "Nominal"
    TREEVIEW FEATURE NOMINAL SELECT ( $index, "On"  )
    TREEVIEW PRIMITIVE POINT PROPERTIES POINT GET (x,y,z)
    PROBE DEVICE GO_XYZ ( $x,$y,$z)
    TREEVIEW FEATURE COLLAPSE
ENDIF

IF $contents == "Nominal and Measured"
    TREEVIEW FEATURE MEASURED SELECT ( $index, "On"  )
    TREEVIEW PRIMITIVE POINT PROPERTIES POINT GET (x,y,z)
    PROBE DEVICE GO_XYZ ( $x,$y,$z)
    TREEVIEW FEATURE COLLAPSE
ENDIF