Util-Get User Origin

From Vectorlab
Jump to: navigation, search


Function to get the user origin shift of a given layer. Distinguishes between sheet layers and design layers. By Orso B. Schmid


{ Orso ************************************************ }
{ gets user origin, shifts between sheet layer and document }
FUNCTION U_GetUserOrigin(layH : HANDLE): POINT;
	VAR
		userLayer: STRING;
	BEGIN
		IF layH <> NIL THEN BEGIN
			BeginContext;
			userLayer := GetLName(ActLayer);
			
			{ if is not active layer, activate layH }
			IF (GetLayerByName(GetLName(layH)) <> NIL) & (layH <> ActLayer) THEN
				Layer(GetLName(layH));
				
			IF NOT GetSheetLayerUserOrigin(layH, U_GetUserOrigin.x, U_GetUserOrigin.y) THEN
				GetOrigin(U_GetUserOrigin.x, U_GetUserOrigin.y);
			
			Layer(userLayer);
			EndContext(0);
		END;
	END;