hiSetBindKey( "Layout" "K" "SCLLeHiCreateMeasurement( geGetEditCellView() 0.855 )" ) procedure( SCLLeHiCreateMeasurement( cvId scaleFactor ) let( ( preMarkerList postMarkerList newMarkerList points deltaX deltaY distance distanceScaled ) ;;; First, before adding a new ruler, store the list of already present markers. ;;; The list after adding will be compared with this list, and the additions will be calculated and reported. preMarkerList = cvId~>markers ;;; Call of the original procedure. leHiCreateMeasurement() ;;; Now that the original procedure has finished, store a new list of Markers. ;;; Unfortunately, only after the measurement function has been escaped, this code will proceed. postMarkerList = cvId~>markers when( newMarkerList = car( last( SCLDiffOfLists( preMarkerList postMarkerList ) ) ) foreach( newMarker newMarkerList points = newMarker~>points deltaX = abs( difference( xCoord( car( points ) ) xCoord( cadr( points ) ) ) ) deltaY = abs( difference( yCoord( car( points ) ) yCoord( cadr( points ) ) ) ) distance = sqrt( plus( times( deltaX deltaX ) times( deltaY deltaY ) ) ) distanceScaled = times( distance scaleFactor ) printf( "%L %L\n" deltaX deltaY ) printf( "After scaling (%L * %L): %L\n" distance scaleFactor distanceScaled ) ) ;;; end of foreach newMarker ) ;;; end of when ) ;;; end of let ) ;;; end of procedure SCLLeHiCreateMeasurement /* This procedure performs a diff of two lists. It does not take order into account though. Please test the code to see what it does: SCLDiffOfLists( list( 1 2 3 4 1 2 3 4 ) list( 3 4 5 6 ) ) The output should be: ((1 2 1 2 3 4) (3 4) (5 6)) This means: (1 2 1 2 3 4) is in the first list, but not in the second. As you can see, if a value appears more then once in list1, but only once in list2, it will report this too. Since this functionality was needed, simply using somethink like setof(item list1 !member( item list2 )) wouldn't work. With the setof implementation the output would be different: (1 2 1 2) (3 4) is in both lists. (5 6) is not in the first list, but it is in the second list. */ procedure( SCLDiffOfLists( inList1 inList2 ) let( () unless( listp( inList1 ) error( "SCLDiffOfLists: argument #1 must be a list - %L" inList1 ) ) ;;; end of unless unless( listp( inList2 ) error( "SCLDiffOfLists: argument #2 must be a list - %L" inList2 ) ) ;;; end of unless list( SCLDiffOfListsCheck( inList1 inList2 ) SCLDiffOfListsCheck( inList1 inList2 "common" ) SCLDiffOfListsCheck( inList2 inList1 ) ) ) ;;; end of let ) ;;; end of procedure SCLDiffOfLists procedure( SCLDiffOfListsCheck( inList1 inList2 @optional ( mode "diff" ) ) let( ( ( outList nil ) ( value1 nil ) ( check1 nil ) ( check2 nil ) ( occurrance1 nil ) ( occurrance2 nil ) ) unless( listp( inList1 ) error( "SCLDiffOfListsCheck: argument #1 must be a list - %L" inList1 ) ) ;;; end of unless unless( listp( inList2 ) error( "SCLDiffOfListsCheck: argument #2 must be a list - %L" inList2 ) ) ;;; end of unless unless( stringp( mode ) error( "SCLDiffOfListsCheck: argument #3 must be a string - %L" mode ) ) ;;; end of unless unless( mode == "diff" || mode == "common" error( "SCLDiffOfListsCheck: argument #3 must either be \"diff\" or \"common\" - %L" mode ) ) ;;; end of unless for( i 1 length( inList1 ) occurrance1 = 1 value1 = nthelem( i inList1 ) check1 = member( value1 inList1 ) while( ( ( length( inList1 ) - length( check1 ) ) + 1 ) != i check1 = member( value1 cdr( check1 ) ) occurrance1++ ) ;;; end of while occurrance2 = 1 check2 = member( value1 inList2 ) while( occurrance2 <= occurrance1 if( check2 then when( equal( mode "common" ) && occurrance2 == occurrance1 outList = append( outList list( value1 ) ) ) ;;; end of when check2 = member( value1 cdr( check2 ) ) occurrance2++ else when( equal( mode "diff" ) outList = append( outList list( value1 ) ) ) ;;; end of when occurrance2 = occurrance1 + 1 ) ;;; end of if check2 ) ;;; end of while ) ;;; end of for i ;;; Returning the output... outList ) ;;; end of let ) ;;; end of procedure SCLDiffOfListsCheck